Section 14.4. Persistent Connections


14.4. Persistent Connections

You can switch to persistent connections in MySQL by changing the function call from mysql_connect( ) to mysql_pconnect( ). They both take the same parameters, with the difference being that mysql_connect( ) will always open a new connection, whereas mysql_pconnect( ) will open a new connection only if there is not one already available. Otherwise, it will just use the existing connection. Similarly, the SQLite function sqlite_open( ) has a persistent counterpart, sqlite_popen( ).

In the per-process Apache module (prefork), persistent resources such as persistent MySQL connections are stored per process. This means if you have 150 Apache children running, you'll need 150 MySQL permanent connectionseven if some of those processes aren't using MySQL right now.




PHP in a Nutshell
Ubuntu Unleashed
ISBN: 596100671
EAN: 2147483647
Year: 2003
Pages: 249

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net