Greetings, The Hermit Hacker!
Well, there's a problem with PHP's [mis]documentation. First of all,
it counts open DB connections not on per-webserver, but on
per-process/thread basis.
The default PHP config file has the limits of persistent and
non-persistent connections set to -1 (no limit)... Setting it to
some (supposedly) reasonable value (like, 50) accomplishes nothing: you
should multiply 50 by the number of webserver processes/threads. There
can be lots of them... :[
And then there comes PHP's "logic": if I can just open the new
connection, why bother reusing the old one? And thus Postgres backends
start multiplying like rabbits, eventually reaching the limit... :[
You should set a reasonable limit on number of open persistent
connections (like 1, maybe 2 or 3), only then PHP will actually reuse
them. My webserver now works with such setup and there are no more
problems with pg_pconnect().
Hell, I never thought I'll give advice to one of PgGurus. ;]
At 16.11.2000, 11:21, you wrote:
THH> I run PHP4 and IMP (http://www.horde.org) and we've gotten then to remove
THH> the useof pg_pconnect() since it is broken. Broken how, you might
THH> ask? Well, I ran on a standalone machine, no other web users but myself,
THH> to test, and each tim eI hit the database with IMP,. it opened a new
THH> backend, but it never reused old, idle ones ... eventually, you run out of
THH> the ability to connect since you've locked up all connections ...
--
Yours, Alexey V. Borzov, Webmaster of RDW