Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unable to connect to PostgreSQL thtough PHP

Status
Not open for further replies.

veenasv

Programmer
Nov 26, 2003
2
US
Hi,
Whenever I try to connect to Postgresql through PHP using pg_connect() I get this error. Same version of PHP,Apache, PostgreSQL are running on another server and there it works fine. I see no differences in these 2 web servers.
Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: IDENT authentication failed for user "postgres"

I have postgres user authorized on all the databases, tables. Please suggest the solution.
 
Need to check the pg_hba.conf file on the offending server. It's set to 'local all ident trust'. So any process connecting locally through the socket is trusted, but as the ower of the process making the connection, and probably defaulting to the name of the owner of the process. In your case, the webserver process owner, (www, apache, whatever) is trying to connect supplying a user of 'postgres'. But they aren't user postgres.

I'm guessing here. Tired again. Whew!

Anyway, see if you can connect via tcp/ip (localhost maybe) or modify pg_hba.conf and change trust ident to md5 and put the password in your pg_connect() call.

Ok, that's a weak answer, I apologize. But it's a push in the right direction. I'm a postgresql newb myself, so take it with a grain of salt ;-)

----
JBR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top