Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 150582E2E55 for ; Tue, 11 Mar 2008 11:00:02 -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 92487-03 for ; Tue, 11 Mar 2008 10:59:29 -0300 (ADT) X-Greylist: delayed 00:26:48.281975 by SQLgrey-1.7.5 Received: from tomts10-srv.bellnexxia.net (tomts10.bellnexxia.net [209.226.175.54]) by postgresql.org (Postfix) with ESMTP id DA3FB2E2E7A for ; Tue, 11 Mar 2008 10:59:35 -0300 (ADT) Received: from toip7.srvr.bell.ca ([209.226.175.124]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20080311133244.IZTK1666.tomts20-srv.bellnexxia.net@toip7.srvr.bell.ca> for ; Tue, 11 Mar 2008 09:32:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgEFACcn1kdBX4fQ/2dsb2JhbACBWKoJ Received: from bas3-london14-1096779728.dsl.bell.ca (HELO t60p.bax.ca) ([65.95.135.208]) by toip7.srvr.bell.ca with ESMTP; 11 Mar 2008 09:34:46 -0400 Message-ID: <47D689F7.4010209@sympatico.ca> Date: Tue, 11 Mar 2008 09:32:39 -0400 From: Frank Bax User-Agent: Thunderbird 2.0.0.6 (X11/20070818) MIME-Version: 1.0 To: pgsql-php@postgresql.org Subject: Re: pg_connect fails, pgsql works References: <47D571EF.8020408@noaa.gov> In-Reply-To: <47D571EF.8020408@noaa.gov> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/10 X-Sequence-Number: 3835 John Cartwright wrote: > 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. Are you using all the same options when starting psql? What psql command are you issuing? Are you running psql on the same system that runs apache/php?