Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Postgresql connection problem on SUSE-9.1
- Derek Fountain
October 18, 2004, 6:52 pm
rate this thread
$c = pg_connect("user=derek dbname=webcalendar");
which produces this error in the browser:
Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: IDENT
authentication failed for user "derek" .
in /home/derek/public_html/misc/testpg.php4 on line 3
And yet, from the command line, it works OK:
Welcome to psql 7.4.2, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
List of relations
Schema | Name | Type | Owner
public | webcal_asst | table | derek
public | webcal_categories | table | derek
public | webcal_config | table | derek
There is no password to access this DB, but adding password='' to the
connection string didn't help. The postgresql error log contains the
message: '2004-10-18 13:47:26 FATAL: IDENT authentication failed for user
Can anyone tell me what I'm doing wrong?
Re: Postgresql connection problem on SUSE-9.1
I think: your PostgreSQL pg_hba.conf is set to use "ident" authentication,
where the ident protocol is used to verify the identity of the connection.
When running through the web server, the web server's user ID (something
like "nobody", usually) is returned, which does not match your claimed
username (user=derek). From command line, you are probably logged in as
yourself so ident verifies it is you.
Consider switching from ident to password-based (md5) authentication and
supplying passwords when connecting. If you stick with ident, you probably
need a database account for the web server's username.