note 39599 added to function.mysql-pconnect

From: Date: Tue, 03 Feb 2004 21:19:58 +0000
Subject: note 39599 added to function.mysql-pconnect
Groups: php.notes 
Request: Send a blank email to php-notes+get-64616@lists.php.net to get a copy of this message
Normally you do NOT want to use mysql_pconnect. This function is designed for environments which have a high overhead to connecting to the database. In a typical MySQL / Apache / PHP environment, Apache will create many child processes which lie in idle waiting for a web request to be assigned to them. Each of these child processes will open and hold its own MySQL connection. So if you have a MySQL server which has a limit of 50 connections, but Apache keeps more than 50 child processes running, each of these child processes can hold a connection to your MySQL server, even while they are idle (idle httpd child processes don't lend their MySQL connection to other httpd children, they hold their own). So even if you only have a few pages which actually connect to MySQL on a busy site, you can run out of connections, with all of them not actually being used. In general use mysql_connect() for connecting to MySQL unless that connection takes a long time to establish. ---- Manual Page -- http://www.php.net/manual/en/function.mysql-pconnect.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39599 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39599&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39599&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64616) next »