 |
| 2005-09-06 09:20 |
| Persistent connections in PHP |
| Public |
|
mysql_pconnect() in PHP... you don't want it. Really.
If you use Apache 1.3, or 2.0 with PreFork, there will be an instance of PHP inside each Apache process. Each of these will have its own cache of persistent connections.
MySQL actually has a very fast connection setup, so it doesn't save time.
With persistent connections, PHP needs to do some cleanup of a connection, to make sure there are no in-progress transactions, or changed server variables. This is a somewhat inexact science. So much so that Georg Richter has actually completely disabled persistent connections in the PHP 5 mysqli extension.
To disable persistent connections, just use mysql_connect() instead.
You can also, very simply, set mysql.allow_persistent = Off in your php.ini file.
Post A Comment | 2 Comments | Add to Memories | Tell a Friend | Link