pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: timothy_maguire@hartehanks.com
To: Jeff Self <jself@ci.newport-news.va.us>
Cc: pgsql-php@postgresql.org
Cc: pgsql-php-owner@postgresql.org
Subject: Re: Not able to connect to server from PHP
Date: Tue, 22 Jan 2002 15:54:22 -0500
Message-ID: <OF8A85BDF3.73F054B0-ON85256B49.0072A40E@hartehanks.com> (raw)


When I connect I don't like to use the user name attribute.  You might also
want to try the port attribute.

Try something like this:

$conn =pg_connect("host=localhost port=5432 dbname=personnel") or die
("unable to connect to Internal DB");

Tim.

Timothy P. Maguire
Web Developer II
Harte-Hanks
978 436 3325



                                                                                                              
                      Jeff Self                                                                               
                      <jself@ci.newport-n        To:       pgsql-php@postgresql.org                           
                      ews.va.us>                 cc:                                                          
                      Sent by:                   Subject:  Not able to connect to server from PHP             
                      pgsql-php-owner@pos                                                                     
                      tgresql.org                                                                             
                                                                                                              
                                                                                                              
                      01/22/2002 03:13 PM                                                                     
                                                                                                              
                                                                                                              




I'm working on a personnel database for my department. I can connect
just fine using 'psql personnel'. I've created a PHP script to get a
list of departments, but I'm getting the following error message:

Warning: Unable to connect to PostgreSQL server: Peer authentication
failed for user 'jeff' in /var/www/personnel/departments.php on line 10
Unable to connect to database.

Here's my script:
<?php
//
// Display Departments
//
// departments.php, v 1.0

include ($DOCUMENT_ROOT.'/personnel/include/functions.inc');

$conn = pg_pconnect("dbname=personnel user=jeff");
if (!$conn) {
 echo "Unable to connect to database.";
 exit;
}

Everything is running locally right now, Apache, PHP, PostgreSQL. I
never modified my pg_hba.conf file. Everything looks identical as my
system at home. I'm running PostgreSQL 7.1.3 and PHP 4.1.1.
--
Jeff Self
City of Newport News
2400 Washington Ave.
Newport News, VA 23607
757-926-6930


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html
HARTE- HANKS PRIVILEGED AND CONFIDENTIAL INFORMATION- if you are not the
addressee or authorized to receive this for the addressee, you must not
use, copy, disclose or take any action based on this message or any
information herein and should delete this message.







view thread (8+ messages)  latest in thread

Message-ID: <OF8A85BDF3.73F054B0-ON85256B49.0072A40E@hartehanks.com>
Permalink:  ../OF8A85BDF3.73F054B0-ON85256B49.0072A40E@hartehanks.com/
Also on:    postgresql.org/message-id/OF8A85BDF3.73F054B0-ON85256B49.0072A40E@hartehanks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: timothy_maguire@hartehanks.com, jself@ci.newport-news.va.us, pgsql-php-owner@postgresql.org
  Subject: Re: Not able to connect to server from PHP
  In-Reply-To: <OF8A85BDF3.73F054B0-ON85256B49.0072A40E@hartehanks.com>
  References: <OF8A85BDF3.73F054B0-ON85256B49.0072A40E@hartehanks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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