[FASTCGI] PHP FastCGI mysql_pconnect

Rasmus Andersson rasmus at flajm.com
Fri Apr 3 08:10:49 EDT 2009


On Fri, Apr 3, 2009 at 00:36, Simon <simon at optinet.com> wrote:
> Hello,
>
> Does anyone know if PHP under FastCGI can keep persistent connection to
> MySQL via mysql_pconnect. I believe the last time I tried this, it wouldn't work.

Yes it can and should. But keep in mind PHP leaks like a broken
umbrella so normally each PHP process is restarted every N requests,
thus dropping any connections. (N is normally 10000 or something).

Even though this really is out of topic for this list :)

Quick question and tip: Why are you using pconnect? It's almost always
a bad idea. Setting up a TCP connection on an internal network is
really cheap in comparison to connecting to other networks. If you are
connecting to an outside network, connection latency might become a
problem and then pconnect is there to ease the pain.


More information about the FastCGI-developers mailing list