Basically the issue I experienced is this.

I tried to install Drupal 6.16 on Linux (Centos with PHP 5.16) and database Postgres 8.1.18

I was not able to move over the creation of connection to the database : I got the error " connection failed ... bla bla bla"
The problem i verified was on the connection on the database through TCP/IP.
From the console i was able to connect to database that is to say
psql -h localhost (or web serverI IP ) -p 5432 -U username --->this worked

but when i tried from PHP with
$conn= pg_connect ("host=localhost dbname=name_database user=username password=password"); --->this didn't work.

I've got this problem with phpPgAdmin as well. The pg_hba.conf was properly configured and the postgresql.conf too.

How did I fix the problem ? Editing the inc files for postgres in Drupal (both for installation and post-installation) and commenting the "host" line in the pg_connect function (in order to use UNIX-socket connection instead of TCP/IP)

I'm here to highlight this issue that seems php dependent and asking for another alternative solution!

Update 25/03/2010
I fixed this issue
SElinux blocked the connection to POSTGRES via TCP/IP .
So disable Selinux or add new module which allow the use of TCP/IP connection ---> here an easy how-to
http://linux.die.net/man/1/audit2allow

Thanks