J.T.,

Apache has a number of processes that standby waiting for requests.
mysql_pconnect (and pg_pconnect) opens up a connection per apache process,
but once a connection has been opened for a process, it will remain for any
subsequents requests handled by that one process.

The MaxClients parameter in httpd.conf of the Apache configuration tell you
the maximum number of processes Apache will have running at any one time,
and therefore you MySQL DB should be set up to handle that many simultaneous
connections (assuming you only make one mysql_connect call per page).

Also, Apache kills and restarts each server processes after it has handled a
certain amount of requests, also killing the persistent database connection.
This is configurable in httpd.conf as the MaxRequestsPerChild parameter,
which you may or may not want to play with.  The requests could be html,
images or whatever else, and so depending on your site, a persistent
connection may only last a few page requests.

Cheers,
Kelly.

> -----Original Message-----
> From: J.T [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 13 September 2001 7:07 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-DB] Repost: Persistent connections is not persistent
>
>
> Actually I don't know if this problem is a PHP-, an Apache- or a
> MySQL-issue, but in this forum probably a lot is using the same
> combination
> of servers, so probably someone has an experience to share with me.
>
> I'm running a PHP-build website (using PHP 4.0.6) and an Apache-server
> (1.3.20) on a Windows 2000-server. PHP is running as a Apache-module. Most
> of pages is password-protected using .htaccess-files.
>
> The website is connecting to a MySQL-server (3.23.41) using
> pconnect(). The
> setup of the MySQL-server is the default in regard of the
> max_connections-variable (set to 100).
>
> As far as I understood, the mysql_pconnect-mechanism should reuse earlier
> connections made by the same user.
>
> However, I can see, that very often just a reload of a page is
> opening a new
> process, and suddenly the max_connections-limit is reached: The user is
> getting 'Too many connections'-errors. The SQL-server is
> restarted and soon
> after the user get 'MySQL Server has gone away'-error. On more
> reload of the
> page makes a new connection.
>
> Before I decide to raise the 'max-connections'-setting, I would be nice to
> hear from anyone with a similar experience. Is there a better
> solution, for
> instance using mysql_connect() and mysql_close() instead of
> mysql_pconnect.
>
> Or is this just a wellknown problem in MySQL? Anyone?
>
>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to