Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 7F72B2E2EAA for ; Tue, 11 Mar 2008 11:00:15 -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 92617-02 for ; Tue, 11 Mar 2008 10:59:39 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from paris.boulder.noaa.gov (paris.boulder.noaa.gov [140.172.10.145]) by postgresql.org (Postfix) with ESMTP id 69F222E2D75 for ; Tue, 11 Mar 2008 10:59:47 -0300 (ADT) Received: from lynx.ngdc.noaa.gov (lynx.ngdc.noaa.gov [140.172.179.24]) by email.boulder.noaa.gov (iPlanet Messaging Server 5.2 HotFix 2.01 (built Aug 26 2004)) with ESMTPSA id <0JXK00BR3K7K16@email.boulder.noaa.gov> for pgsql-php@postgresql.org; Tue, 11 Mar 2008 13:59:45 +0000 (GMT) Date: Tue, 11 Mar 2008 07:59:44 -0600 From: John Cartwright Subject: Re: pg_connect fails, pgsql works In-reply-to: <31ed54e50803102233y58717cddh738e292fbffa0c8@mail.gmail.com> To: "F. Jovan Jester" Cc: pgsql-php@postgresql.org Message-id: <47D69050.2010607@noaa.gov> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT User-Agent: Thunderbird 2.0.0.12 (X11/20080213) References: <47D571EF.8020408@noaa.gov> <31ed54e50803102233y58717cddh738e292fbffa0c8@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/11 X-Sequence-Number: 3836 Thanks for the suggestion Jovan. It turned out to be a SELinux permissions issue that only affected apache processes. -- john F. Jovan Jester wrote: > 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 > > > >