Please read www.php.net/manual/features.persistent-connections.php.
Currently on UNIX, Apache and PHP is a single-threaded process where the main web server creates children to deal with HTTP requests. When you set allow_persistent to On in your php.ini file and use odbc_pconnect
, a persistent connection will be created in one of the HTTP child processes. However, it is up to the main HTTP daemon which child will handle the request, and the persistent connection only exists in that HTTP child. You cannot control which HTTP child process will answer the request, so it may be one which has never connected to the database (Active Persistent Links = 0) or one which has connected to the database (Active Persistent Links = 1). This is easy to confirm for yourself:
phpinfo()
— it will display "Active persistent Links = 0". No matter how many times you refresh this page, it will show 0.odbc_pconnect()
.
The only way to get Active Persistent Links greater than 1 is to open more than one persistent connection in a single PHP script.