Re: Fwd: MySQLi not closing connections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I have never written an application using persistent connections, but
I did get hired at a company where the other programmers describe the
same problem you're having (a proliferation of connections that
overwhelmed the server).  They blamed mysql_pconnect() and the lead
programmer said that after he banned the use of that function, the
problem went away completely.  A comment to the PHP documentation
suggests this is the result of a bad interaction between Apache and
PHP.

Not really true.

pconnect leaves the connection open ('persistent'). From the manual: "when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password."

If you're on a shared host with lots of different mysql username/passwords floating around, pconnect will be a very bad idea - because you'll end up with lots of connections sitting around doing nothing (and never being re-used).

If you're on dedicated hardware, pconnect can cut down the connection time - but when using them, you need to tune apache as well.

There's lots of notes here:

http://www.php.net/manual/en/features.persistent-connections.php

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux