PDA

View Full Version : php + postgresql pg_connect problem



goneskiing
December 13th, 2005, 01:19 AM
I am having trouble connecting php(5.1.1) and postgresql(8.1). Both run fine separately. I get the following error using pg_connect:

Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: Ident authentication failed for user "tempuser" in /var/www/db_connect.php on line 14

The line 14 is the pg_connect statement: pg_connect(dbname=tempdb user=tempuser).

If I run psql -l it shows the database "tempdb" with the username "tempuser". Now I did not create a password when I created the user and in pg_connect just use the dbname and username values - is that a problem? thanks.

ph0x
December 13th, 2005, 12:36 PM
I'd try with something like


passwd=""



greetz ph0x

goneskiing
December 13th, 2005, 06:01 PM
thanks for the suggestion, but it did not work. Are there other ways to test ?

goneskiing
December 14th, 2005, 03:42 AM
okay - fixed. Solution was to change the pg_hba.conf file for local operation

schmidty
February 3rd, 2006, 06:45 AM
Thanks for the fix...I was wondering if this issue would cause a problem if you were going to run a server using PHP5, PostgreSQL 8 and Apache2 in cyberspace? Anyone know the answer?

Schmidty