PHP not closing db connection

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

PHP not closing db connection

Post by Johnm »

Hi all,
Ever since I upgraded to PHP 4.2.2 (from 4.06) I find that the connestions to the database are not being closed even though I am using ifx_close($dbid) at the end of each page. Any ideas?

Direwolf
Baka2002
Forum Newbie
Posts: 5
Joined: Wed Oct 02, 2002 8:56 pm

Persistent Links

Post by Baka2002 »

"...Note that this isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution.
ifx_close() will not close persistent links generated by ifx_pconnect(). " "PHPManual"

Check to see if your using persistent links, maybe thats your problem
User avatar
Johnm
Forum Contributor
Posts: 344
Joined: Mon May 13, 2002 12:05 pm
Location: Michigan, USA
Contact:

Post by Johnm »

So, if ifx_close() has no effect on persistant connections and non persistant connections close at the end of the scripts execution then ifx_close has no purpose??? Why was it developed if it has no real use?

Direwolf
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

If you had a really long script and you only had your database stuff at the top you could close the connection before the end of the script because you no longer need it and want to free up database connections for other users. It just depends on your scripts really.

Mac
Post Reply