Re: Connect error

From: "Rod K" <rod(at)23net(dot)net>
To: "Russell Shaw" <rjshaw(at)iprimus(dot)com(dot)au>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Connect error
Date: 2004-01-12 16:52:41
Message-ID: KNEPILBLIADCDMMPIKIKIENBECAA.rod@23net.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Since apache is not running as russell, you have to provide your password in
the connection string:

$conn=pg_connect("dbname=parts_list user=russell password=yourpassword");

This would be equivilent to being in a *nix shell as a DIFFERENT user and
attempting:

psql -U russell

and expecting to be able to connect. Won't work. Ident authentication
requires that you BE the user that you are trying to connect as.

The only way you could connect from PHP (as an Apache module) without a
password is for the user Apache runs as to be the postgres user. NOT a good
idea....

> -----Original Message-----
> From: pgsql-novice-owner(at)postgresql(dot)org
> [mailto:pgsql-novice-owner(at)postgresql(dot)org]On Behalf Of Russell Shaw
> Sent: Monday, January 12, 2004 10:33 AM
> To: pgsql-novice(at)postgresql(dot)org
> Subject: [NOVICE] Connect error
>
>
> Hi,
>
> I created a database in debian using psql (as database user
> russell). My php4 script
> can't access it. It reports:
>
> Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL:
> IDENT authentication failed for user "russell" . in
> /home/russell/public_html/hello.php on line 2
>
> The script is:
>
> <?php
> $conn=pg_connect("dbname=parts_list user=russell");
> if(!$conn)
> exit(pg_result_error($conn));
> ?>
>
> I have apache-1.3 running ok. In /etc/postgresql/pg_hba.conf, i
> have "ident sameuser". I can access the database ok from my user
> account using psql. What can i check now?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Bill Moseley 2004-01-12 17:29:00 Re: Connect error
Previous Message Sai Hertz And Control Systems 2004-01-12 16:44:41 Re: Connect error