Re: Fwd: [PHP-DB] MySQLi not closing connections

[email protected] (Chris)
Newsgroups php.db
Message-ID <[email protected]>
> 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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.