Re: mysql_pconnect & mysql_connect

From: Date: Thu, 31 Jan 2002 04:53:34 +0000
Subject: Re: mysql_pconnect & mysql_connect
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-82864@lists.php.net to get a copy of this message
At 11:40 PM 1/2/2002 -0500, jtjohnston wrote:
Jim, Thanks. What I don't really get is what persistent means. A problem I'm having with my mysql server is that it is a whole bunch of messages with in the space of 5 minutes like: 020130 16:11:08 C:\PROGRA~1\EASYPHP\MySql\bin\mysqld.exe: Forcing close of thread 3 user: 'root' All I have to do is reload the same page a dozen times. To test out the whole thing I'm replacing all my mysql_pconnect for mysql_connect and adding mysql_close to force a closure of the connection. Scripts just didn't seem to be closing. Hence the question. It's supposed to be persistent only until the script finishes, but I can prove otherwise. A windows thing? Who knows? John
Actually, from what I understand, with the persistent connection, it is left open even after the script is finished - that's why it's called persistent. Read this excerpt from the link I sent you: mysql_pconnect() acts very much like mysql_connect() with two major differences. First, when connecting, the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection. Second, the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use (mysql_close() will not close links established by mysql_pconnect()). This type of link is therefore called 'persistent'. Note: Note, that these kind of links only work if you are using a module version of PHP. See the Persistent Database Connections section for more information. -Jeff (not Jim)

« previous php.general (#82864) next »