[nycphp-talk] When to close a mysql connection
David Krings
ramons at gmx.net
Thu Jun 28 17:44:29 EDT 2007
Ben Sgro (ProjectSkyline) wrote:
> Hello,
>
> Doesn't using pconnect take care of this?
> http://us.php.net/manual/en/function.mysql-pconnect.php
>
> What's the best implementation?(provide some source if you can...)
>
> - Ben
>
I currently have the connection stuff inside of an include file. So I
basically would change the line with the mysql_connect to mysql_pconnect
and ditch all the mysql_close lines that I have in my script, since
mysql_close does not close persistent connections. But then again, how
do I close a persistent connection? Uh...found it, the connection gets
dropped automatically by MySQL.
Hmmmmmm, I am not really convinced that this is as good as it sounds.
Especially in my current project I allow the active work frame to be 24
hours before I force users out (will make that configurable later). I
must then set the MySQL timeout to at least the same value, which
potentially could cause that MySQL holds many connections.
Yea, what is the best implementation?
David
More information about the talk
mailing list