On Tue, 21 May 2002, Soon-Son Kwon wrote:
> Hello: I am running pgsql on debian GNU/Linux woody box
> to run "sourceforge" program. (http://www.freesoftware.fsf.org/debian-sf/)
>
> Here is part of the /etc/postgresql/postgresql.conf:
>
> ---
> debug_level = 0
> log_connections = on
> log_pid = on
> log_timestamp = on
> syslog = 2
> # if syslog is 0, turn silent_mode off!
> silent_mode = off
> syslog_facility = LOCAL0
> trace_notify = off
This setting here:
> max_connections = 64
tells postgresql how many connections it can accept max.
In Apache's httpd.conf file, the line
MaxClients 90
says how many clients the web server can accept connections from. This is
the maximum number of "child processes" apache will spawn.
In php.ini we find the lines:
pgsql.allow_persistent = On
pgsql.max_persistent = 2 #max persistant links per process
pgsql.max_links = 16 # max pers/non-pers links per process
We need to make sure that PHP/Apache don't try to open more than
postgresql is configured for.
You probably should increase the max_connections setting in
postgresql.conf first, to at least 128 or 256.
then, you need to set MaxClients * pgsql.max_persistant to be <
max_connections. Be sure and leave one or two spare connects for you to
be able to get via a psql command line.
note that if you are running >1 web server against one database server,
you then have to have num_web_servers * MaxClients * pgsql.max_persistant
< max_connections.
This is a common problem with persistant connections, and the method for
setting up a web server to handle persistant connects with php/apache is
non-obvious. but it does work.