Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 97A152E004E for ; Tue, 11 Mar 2008 02:40:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 08225-02 for ; Tue, 11 Mar 2008 02:40:45 -0300 (ADT) X-Greylist: delayed 00:07:13.498439 by SQLgrey-1.7.5 Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.187]) by postgresql.org (Postfix) with ESMTP id 5BA3D2E0274 for ; Tue, 11 Mar 2008 02:40:47 -0300 (ADT) Received: by rv-out-0910.google.com with SMTP id g13so1506515rvb.43 for ; Mon, 10 Mar 2008 22:40:44 -0700 (PDT) Received: by 10.141.171.6 with SMTP id y6mr3851352rvo.84.1205213612229; Mon, 10 Mar 2008 22:33:32 -0700 (PDT) Received: by 10.141.206.7 with HTTP; Mon, 10 Mar 2008 22:33:32 -0700 (PDT) Message-ID: <31ed54e50803102233y58717cddh738e292fbffa0c8@mail.gmail.com> Date: Tue, 11 Mar 2008 01:33:32 -0400 From: "F. Jovan Jester" To: "John Cartwright" Subject: Re: pg_connect fails, pgsql works Cc: pgsql-php@postgresql.org In-Reply-To: <47D571EF.8020408@noaa.gov> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_349_30841439.1205213612235" References: <47D571EF.8020408@noaa.gov> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200803/9 X-Sequence-Number: 3834 ------=_Part_349_30841439.1205213612235 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline are you sure it's not some kind of firewall issue? can you post your pg_hba conf to make sure it's set up properly? Only other thing i can think of is to try changing the host to IP address form, in case there's some kind of DNS resolution problem. hope that helps, -Jovan On 3/10/08, John Cartwright wrote: > > Hello All, > > I'm using php 5.1.6 on a RHEL 5 system connecting to a postgresql server > version 8.2.3. I think that TCP connections are enabled correctly in > the server's pg_hba.conf and I can successfully connect from the client > using pgsql. However, trying to use pg_connect() w/ a call like: > > $con = pg_connect("host='postgres1.ngdc.noaa.gov' port=5432 > sslmode='allow' user='test' password='mypassword' dbname='test'") > > > fails saying: > > Unable to connect to PostgreSQL server: could not connect to server: > Permission denied\n\tIs the server running on host > "postgres1.ngdc.noaa.gov" and accepting\n\tTCP/IP connections > on port 5432? > > I'm perplexed since I can connect w/ pgsql from the same workstation > using the same database, user, password. > > Can anyone help me out here? > > Thanks! > > -- john > > > > -- > Sent via pgsql-php mailing list (pgsql-php@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-php > ------=_Part_349_30841439.1205213612235 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline are you sure it's not some kind of firewall issue?

can you post your pg_hba conf to make sure it's set up properly?

Only other thing i can think of is to try changing the host to IP address form, in case there's some kind of DNS resolution problem.

hope that helps,

-Jovan


On 3/10/08, John Cartwright <John.C.Cartwright@noaa.gov> wrote:
Hello All,

I'm using php 5.1.6 on a RHEL 5 system connecting to a postgresql server
version 8.2.3.   I think that TCP connections are enabled correctly in
the server's pg_hba.conf and I can successfully connect from the client
using pgsql.  However, trying to use pg_connect() w/ a call like:

$con = pg_connect("host='postgres1.ngdc.noaa.gov' port=5432
sslmode='allow' user='test' password='mypassword' dbname='test'")


fails saying:

  Unable to connect to PostgreSQL server: could not connect to server:
Permission denied\n\tIs the server running on host
&quot;postgres1.ngdc.noaa.gov&quot; and accepting\n\tTCP/IP connections
on port 5432?

I'm perplexed since I can connect w/ pgsql from the same workstation
using the same database, user, password.

Can anyone help me out here?

Thanks!

-- john



--
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php



------=_Part_349_30841439.1205213612235--