On Tue, 28 Aug 2001, Brian Grayless wrote:

> Gotta problem....
> For some reason, many of my persistent connections aren't terminating. I end
> up with up to 30 connections to MySQL that aren't being used. My guess is
> that the user connection is slow and  the script never finishes running or
> something.
> Is there a way to get all my connections to close, or is there a PHP script
> that can close any unused connections???

Regarding persistent connections, this is how I believe it works:
In apache httpd.conf you have:
MinSpareServers 5
MaxSpareServers 10

The MaxSpareServers gives you the maximum of apache daemons running

In php.ini, you have these statements:
mysql.max_persistent    = -1

-1 is default, change this to the number of maximum persistent connections
per apache daemon. This will give you the following formula:

total_persistent_connections = MaxSpareServers * mysql.max_persistent

The MySQL-configuration my.cnf:

set-variable    = max_connections=255
set-variable    = wait_timeout=3600

Make sure that total_persistent_connections is less than max_connections,
to give you some overhad for non persistent connections and other mysql
sessions. The wait_timeout variable is simply the maximum idle time for a
connection to exist. Lower it if you have still have problems with the php
persistent connections.

This should really be in the FAQ.

 patrik wallstrom     |      f o o d f i g h t
 tel: +46-8-6188428   |      s t o c k h o l m
 gsm: +46-709580442   |      - - - - - - - - -

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