php problem with pg_connect()

Avram Aumick avi at m-issues.org
Thu May 27 22:50:51 UTC 2004


I keep getting the following error since upgrading from RH8 to RC1 when I
try to connect to my postgresql database:
<error>
Warning: pg_connect(): Cannot create new link. Too many open links (0) in
test.php on line 15
stat =
Connection status bad
Could not connect!

Warning: pg_last_error(): supplied argument is not a valid PostgreSQL link
resource in test.php on line 30
</error>

The following is the code that is used:

<code>
$conn_string = "dbname=$dbname";
echo "conn_string: ".$conn_string."<br />";

$db = pg_connect($conn_string);

   $stat = pg_connection_status($db);
   echo "stat = ".$stat."<br />";;
   if ($stat === 0) {
       echo 'Connection status ok<br />';
   } else {
       echo 'Connection status bad<br />';
   }
//see if our connection was successful
if (!$db) {
	//connection failed - exit the page with an error
	//you could also try to proceed without the
	//database - it's up to you
  echo "Could not connect!<br />";
	echo pg_last_error($db);
	exit;
</code> (this is used just for email purposes)

I have php-pgsql installed. I am not sure what was changed. Note that
prior to doing the upgrade I did a save of the postgresql db as required
under postgresql and after the upgrade I followed the procedure to restore
the db. (I've done this in the past without any problems)

Any ideas??

-----------
You know you're getting old when you talk about what
you've done, rather than what you're going to do.





More information about the fedora-list mailing list