php + postgresql pg_connect problem - Mailing list pgsql-general

From John Taber
Subject php + postgresql pg_connect problem
Date
Msg-id 439F306A.4000801@johntaber.net
Whole thread Raw
Responses Re: php + postgresql pg_connect problem
List pgsql-general
I am having trouble connecting php(5.1.1) and postgresql(8.1) running on
Ubuntu Breezy. Both run fine separately. I created a user (tempuser) and
a database (tempdb).  If I run psql -l it shows the database "tempdb"
with the username "tempuser".  But 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:
    $dbname = "tempdb";
    $user = "tempuser";
    $pass = "";
    $dbstr = "dbname=" . $dbname;
    $dbstr .= " user=" . $user;
    //$dbstr .= " password=" . $pass;
    return(pg_connect($dbstr));

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.
ps: I tried it with the password value but that failed with same error.


pgsql-general by date:

Previous
From: "Peter L. Berghold"
Date:
Subject: triggering on deletes, NEW row or OLD row?
Next
From: "Jim C. Nasby"
Date:
Subject: Re: pg_autovacuum