RE: [PHP] new connection with pg_pconnect

From: Date: Thu, 14 Oct 2004 20:19:57 +0000
Subject: RE: [PHP] new connection with pg_pconnect
Groups: php.general 
Request: Send a blank email to php-general+get-199524@lists.php.net to get a copy of this message
[snip] I'm trying to add some new features to an existing project. The project uses pg_pconnect and sets it into a global var... What I'm trying to do is to create a new database class which connects to a different database on the same server. By the time my code gets reached, the pg_pconnect global var $conn has already been initialized. ... Is the persistent connection open only to the database in which it was opened for? How can I choose a different database? [/snip] Yes, a persistent connection will only be used when all the connection parameters are the same. Ergo a new database requires a new connection. That said, I would also like to point out that there is a bug which can be found with php and persistent postgres connections. http://bugs.php.net/bug.php?id=25404 The solution is to use non-persistent connections. I'd had a problem over the past few months wherein users of my CMS were getting logged out for no reason, and yesterday I was finally able to trace it to this. Switched to non-persistent connections and not one error has occurred since, so this might be something to keep in mind. Cheers and HTH, Pablo

« previous php.general (#199524) next »