pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Help in connecting to a database with PHP
3+ messages / 3 participants
[nested] [flat]

* Help in connecting to a database with PHP
@ 2002-05-27 06:07 Michael J. McGillick <mmcgillick@attbi.com>
  2002-05-27 08:55 ` Re: Help in connecting to a database with PHP Ludwig Lim <lud_nowhere_man@yahoo.com>
  2002-05-27 09:30 ` Re: Help in connecting to a database with PHP Eckhard Hoeffner <e-hoeffner@fifoost.org>
  0 siblings, 2 replies; 3+ messages in thread

From: Michael J. McGillick @ 2002-05-27 06:07 UTC (permalink / raw)
  To: pgsql-php

Hi:

 

I'm trying to learn how to set up a .php file to connect to my
PostgreSQL database. From the command line, I can connect, open and work
in the database on my machine. However, if I create a .php page with the
following information:

 

   $db = pg_connect("dbname=baseball user=postgres");

 

I get the following error message:

 

   Warning: Unable to connect to PostgreSQL server: FATAL 1: IDENT
authentication failed for user "postgres" in /var/www/html/baseball.php
on line 10.

 

I'm running a stock Red Hat Linux 7.3 machine with PostgreSQL version
7.2. I have verified that from the command line, I can switch to the
user postgres and connect to the database with no problems. I can view
data, add and delete records, etc.

 

I'd appreciate some help in trying to track down what I'm doing wrong.
I've spent the past few days looking at documentation from various web
sites, and nothing seems to jump out as the culprit.

 

- Michael

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Help in connecting to a database with PHP
  2002-05-27 06:07 Help in connecting to a database with PHP Michael J. McGillick <mmcgillick@attbi.com>
@ 2002-05-27 08:55 ` Ludwig Lim <lud_nowhere_man@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Ludwig Lim @ 2002-05-27 08:55 UTC (permalink / raw)
  To: mmcgillick@attbi.com; pgsql-php

Hi:

--- "Michael J. McGillick" <mmcgillick@attbi.com>
wrote:
> Hi:
> 
>  
> 
> I'm trying to learn how to set up a .php file to
> connect to my
> PostgreSQL database. From the command line, I can
> connect, open and work
> in the database on my machine. However, if I create
> a .php page with the
> following information:
> 
>  
> 
>    $db = pg_connect("dbname=baseball
> user=postgres");
> 
>  
> 
> I get the following error message:
> 
>  
> 
>    Warning: Unable to connect to PostgreSQL server:
> FATAL 1: IDENT
> authentication failed for user "postgres" in
> /var/www/html/baseball.php
> on line 10.

  Try checking the file "pg_hba.conf" ( Usually in
/usr/local/pgsql/data). It seems that your connection
requires a password. try to set the "auth_type" to
"trust" in "pg_hba.conf" to skip password check or use
"pg_connect(dbname=baseball user=postgres
password=<password of the user account "postgres");"

Hope that helps.

ludwig.

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Help in connecting to a database with PHP
  2002-05-27 06:07 Help in connecting to a database with PHP Michael J. McGillick <mmcgillick@attbi.com>
@ 2002-05-27 09:30 ` Eckhard Hoeffner <e-hoeffner@fifoost.org>
  1 sibling, 0 replies; 3+ messages in thread

From: Eckhard Hoeffner @ 2002-05-27 09:30 UTC (permalink / raw)
  To: pgsql-php

* Michael J. McGillick <mmcgillick@attbi.com> [27 05 02 08:07]:

>Hi:
>
> 
>
>I'm trying to learn how to set up a .php file to connect to my
>PostgreSQL database. From the command line, I can connect, open and work
>in the database on my machine. However, if I create a .php page with the
>following information:
>
> 
>
>   $db = pg_connect("dbname=baseball user=postgres");
>
> 
>
>I get the following error message:

If you are accessing the database via a web server, you should allow
TCP/IP connections. (postmaster -i)

>   Warning: Unable to connect to PostgreSQL server: FATAL 1: IDENT
>authentication failed for user "postgres" in /var/www/html/baseball.php
>on line 10.
This looks like a socket connection, not TCP/IP. 
> 
>
>I'm running a stock Red Hat Linux 7.3 machine with PostgreSQL version
>7.2. I have verified that from the command line, I can switch to the
>user postgres and connect to the database with no problems. I can view
>data, add and delete records, etc.
>
> 
>
>I'd appreciate some help in trying to track down what I'm doing wrong.
>I've spent the past few days looking at documentation from various web
>sites, and nothing seems to jump out as the culprit.
>
> 
>
>- Michael
>

-- 
--//--\\--
Eckhard Hoeffner
e-hoeffner@fifoost.org
Tal 44 
D-80331 München



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-05-27 09:30 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-05-27 06:07 Help in connecting to a database with PHP Michael J. McGillick <mmcgillick@attbi.com>
2002-05-27 08:55 ` Ludwig Lim <lud_nowhere_man@yahoo.com>
2002-05-27 09:30 ` Eckhard Hoeffner <e-hoeffner@fifoost.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox