Postgres: Db connect fail,

Hi,
I'm having issues with PHP and Postgres, it's not a MySource Matrix issue per se.



At step 11, I get: DB Error: connect failed when connecting to database.



I'm on Debian (Sarge). I have installed Apache2, PHP4 both client and apache2-mod, php4-pgsql.

I have configured Postgres with the -i option to get TCP listening.

I have modified my pg_hba.conf into trusting everything (just for the time being and to confirm that it's not the issue). My php.ini contains: extension=pgsql.so



psql works both localy and remotely.



I've had a look at my phpinfo().

The debian package is configured --without-pgsql. However, if I scroll down i get the following:

[quote]pgsql

PostgreSQL Support enabled

PostgreSQL(libpq) Version  7.4.6

Multibyte character support  enabled

SSL support  enabled

Active Persistent Links  0

Active Links  0



Directive Local Value Master Value

pgsql.allow_persistent On On

pgsql.auto_reset_persistent Off Off

pgsql.ignore_notice Off Off

pgsql.log_notice Off Off

pgsql.max_links Unlimited Unlimited

pgsql.max_persistent Unlimited Unlimited[/quote]

I've created a test page with pg_connect("host=localhost port=5432 dbname=mysource");

and i'm getting the following:

[quote]Warning: pg_connect(): Cannot create new link. Too many open links (0)[/quote]



Any idea?

Thanks.

Is Postgres configured to listen on the IP address? By default, it only listens on its Unix socket, so the DSN should be pgsql://user:password@unix()/database.


Hope that does it!

Hey Avi,
i read your (pinned) post about unix() earlier and tried it. In step 10 i tried: localhost, unix() and the actual IP address. All with the same result.



Running netstat i get the following:

[quote]Proto Recv-Q Send-Q Local Address          Foreign Address      State    PID/Program name

tcp    0          0          0.0.0.0:5432        0.0.0.0:*            LISTEN  16651/postmaster[/quote]Any other suggestions?

Ok, as mentioned in my initial post, this was not a MySource Matrix issue.
Apparently, PostgreSQL needs to be installed first, then PHP.



I uninstalled apache, postgres and php and then reinstalled in the following order:

postgresql

apache2

php4-pgsql

php4

(that is not the comprehensive list of Debian packages installed/required)



I hope this post can save people some time…