[thelist] Apache and PostGreSQL

Johnny Jørgensen aggie at aggie.dk
Thu Feb 14 01:46:01 CST 2002


This may be a bit on the heavy side, but you people have so far given
the appearance of being a resourceful lot, so i'll give it a try;

I have an Apache/PHP server and a PostGreSQL server running on two
servers, running RedHat 7.2 out of the box (rpm installs), which cause a
heap of problems.

After some time (~15 minutes) of development, the postgresql server
refuses any more connections from the http server, apparently because
old sessions aren't closed. I have been unable to figure out if it's the
http server keeping child processes alive after delivering the pages, or
the postgresql server keeping open the connection waiting for queries
that never arrive.

I have some succes closing down httpd and restarting it, could mean
that's where the problem lies, but beyond that, i'm clueless..

Any suggestions are certainly welcome,


<tip type='PHP OOP/Coding practice' author='Johnny Jørgensen'>
Even if you're not entirely into the finer points of Object Oriented
Programming, inheritance and whatnot, it's well worth the effort to
learn the syntax, and use objects for structuring closely knit functions
and variables.

A bundle of functions all handling communication with a database might
well be collected in an object, together with variables holding server,
port, username and password as well as error messages, and whatever else
might come in handy.

This also helps keeping 'small' vaiables such as $err_msg apart,
preventing error messages from file system handling from overwriting the
last barf from the database. (Albeit descriptive variable naming is the
proper fix for this problem).
</tip>

--
Johnny Jørgensen <aggie at aggie.dk>

"No. Try Not. Do. Or Do Not. There is no Try." - yoda




More information about the thelist mailing list