PHP and PostgreSQL 9.0, pg_connect fails to connect

From: Thomas Harold <thomas-lists(at)nybeta(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: PHP and PostgreSQL 9.0, pg_connect fails to connect
Date: 2011-04-27 13:16:36
Message-ID: 4DB81734.8050202@nybeta.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm having trouble figuring out where this one is going wrong. It's a
brand new install of PostgreSQL 9.0 from PGDG on a RHEL5 box, running
Apache 2.2 and PHP 5.3 (from IUS).

- PostgreSQL 9.0 is running and listening on the localhost. I can run
pgAdmin III and connect to it over a SSH port-forward to the loopback.

- nmap reports that pgsql is alive and listening on localhost:5432.

- I can use the psql command to connect to the localhost and am able to
login as the username/password that I'm using in the pg_connect() call.
I can connect to the target database. I can create tables in the
database/schema using that username (so pgsql roles don't seem to be the
issue).

- SELinux is running, but there are no denied messages in
/var/log/audit/audit.log and no setroubleshooting alerts in
/var/log/messages either.

- The firewall doesn't seem to be the issue (due to the nmap query).

- I've tried forcing IPv4 by specifying the database server as 127.0.0.1
instead of localhost.

- No errors in the Apache logs either.

- The server came with PHP 5.1.6 and I've tried out an early version of
PHP 5.3, then upgraded to 5.3.6.

All I'm getting back from pg_connect() is "Connect: failed to connect to
database.".

Is there a specific minimum version of the php-pgsql add-on that is
needed in order to talk to a pgsql 9.0 database? Am I going to need to
compile PHP from source (using the pgsql 9.0 developer packages)?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2011-04-27 13:49:34 Re: Best way to construct PostgreSQL ArrayType (_int4) from C int array
Previous Message Thomas Kellerer 2011-04-27 13:08:19 Re: Create Database automatacally after silent installation of postgresql. ?