[imp] Still Postgres Persistent Conections problems

Rich Lafferty rich@horde.org
Wed, 14 Mar 2001 10:29:23 -0500


On Wed, Mar 14, 2001 at 07:01:10AM -0600, Brent J. Nordquist (bjn@horde.org) wrote:
> On Wed, 14 Mar 2001, Alexander E. Belck <alexb@iol.psi.br> wrote:
> 
> > The errors that this change causes follows (I copyed them after trying to
> > login with db.pgsql changed to use pg_connect):
> >
> > Warning: 1 is not a valid PostgreSQL link resource in
> > /usr/local/apache/php/db_pgsql.inc on line 52
> 
> Sorry I don't have anything to suggest for this one; I don't know very
> much about PostgreSQL as we're not yet using it in production here.
> Hopefully someone else will have a suggestion.

Blah. There's a somewhat obscure and regressive PHP/Postgres mandelbug
in which PHP apparently identifies open connections by the string used
to open them, thinking for some reason that that's going to be
unique. So you get

  $dba = pg_connect("name=foo password=bar database=baz");
  $dbb = pg_connect("name=foo password=bar database=baz");
  pg_close($dba);
  # $dbb may also be closed now

But either of these work:

  $dba = pg_connect("name=foo password=bar database=baz");
  $dbb = pg_connect("name=foo password=bar database=baz      ");

  $dba = pg_connect("name=foo password=bar database=baz");
  $dbb = pg_connect("password=bar name=foo database=baz");

For now, I guess, change back to pg_pconnect. :-/ I've opened a bug
with the PHP guys; it's at <http://www.php.net/bugs.php?id=9746>.  I'd
really like to avoid messy hacks to get around this, but I'm not below
them. :-)

I *did* just find a machine here on which I can duplicate the problem,
at least; unfortunately, it's a production box on which I can't
install IMP to test, but hopefully we'll be able to nail the problem
in PHP.

Could you please send me the output of 'uname -a' on the system
exhibiting the problem behaviour?

   -Rich

-- 
------------------------------ Rich Lafferty ---------------------------
 Sysadmin/Programmer, Instructional and Information Technology Services
   Concordia University, Montreal, QC                 (514) 848-7625
------------------------- rich@alcor.concordia.ca ----------------------