Postgresql connection problem on SUSE-9.1

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm running PHP-4.3.4 and Postgresql 7.4.2 on SUSE-9.1. I have this piece of

$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:

Quoted text here. Click to load it
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

webcalendar=# \dt
                 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

Derek Fountain wrote:
Quoted text here. Click to load it
try adding host=localhost to the connect string. This forces the use of
tcp/ip connections. It *might* work (:


Re: Postgresql connection problem on SUSE-9.1 wrote:
Quoted text here. Click to load it

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.

Site Timeline