pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_connect fails, pgsql works
7+ messages / 4 participants
[nested] [flat]
* pg_connect fails, pgsql works
@ 2008-03-10 17:37 John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-10 18:44 ` Re: pg_connect fails, pgsql works Raymond O'Donnell <rod@iol.ie>
2008-03-11 05:33 ` Re: pg_connect fails, pgsql works F. Jovan Jester <jesterj@groupspeak.com>
2008-03-11 13:32 ` Re: pg_connect fails, pgsql works Frank Bax <fbax@sympatico.ca>
0 siblings, 3 replies; 7+ messages in thread
From: John Cartwright @ 2008-03-10 17:37 UTC (permalink / raw)
To: pgsql-php
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pg_connect fails, pgsql works
2008-03-10 17:37 pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
@ 2008-03-10 18:44 ` Raymond O'Donnell <rod@iol.ie>
2008-03-10 20:06 ` Re: pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
2 siblings, 1 reply; 7+ messages in thread
From: Raymond O'Donnell @ 2008-03-10 18:44 UTC (permalink / raw)
To: John Cartwright <John.C.Cartwright@noaa.gov>; +Cc: pgsql-php
On 10/03/2008 17:37, John Cartwright wrote:
> $con = pg_connect("host='postgres1.ngdc.noaa.gov' port=5432
> sslmode='allow' user='test' password='mypassword' dbname='test'")
I don't think you need to quote the host, uid, etc - try it without the
single quotes, e.g.
"host=postgres1.ngdc.noaa.gov port=5432 sslmode=allow user=test [....]"
HTH,
Ray.
---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pg_connect fails, pgsql works
2008-03-10 17:37 pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-10 18:44 ` Re: pg_connect fails, pgsql works Raymond O'Donnell <rod@iol.ie>
@ 2008-03-10 20:06 ` John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-10 20:10 ` Re: pg_connect fails, pgsql works Raymond O'Donnell <rod@iol.ie>
0 siblings, 1 reply; 7+ messages in thread
From: John Cartwright @ 2008-03-10 20:06 UTC (permalink / raw)
To: rod@iol.ie; +Cc: pgsql-php
Thanks for your suggestion Ray, but I get the same error even w/o the
values being single-quoted.
-- john
Raymond O'Donnell wrote:
> On 10/03/2008 17:37, John Cartwright wrote:
>
>> $con = pg_connect("host='postgres1.ngdc.noaa.gov' port=5432
>> sslmode='allow' user='test' password='mypassword' dbname='test'")
>
> I don't think you need to quote the host, uid, etc - try it without
> the single quotes, e.g.
>
> "host=postgres1.ngdc.noaa.gov port=5432 sslmode=allow user=test [....]"
>
> HTH,
>
> Ray.
>
> ---------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod@iol.ie
> ---------------------------------------------------------------
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pg_connect fails, pgsql works
2008-03-10 17:37 pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-10 18:44 ` Re: pg_connect fails, pgsql works Raymond O'Donnell <rod@iol.ie>
2008-03-10 20:06 ` Re: pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
@ 2008-03-10 20:10 ` Raymond O'Donnell <rod@iol.ie>
0 siblings, 0 replies; 7+ messages in thread
From: Raymond O'Donnell @ 2008-03-10 20:10 UTC (permalink / raw)
To: John Cartwright <John.C.Cartwright@noaa.gov>; +Cc: pgsql-php
On 10/03/2008 20:06, John Cartwright wrote:
> Thanks for your suggestion Ray, but I get the same error even w/o the
> values being single-quoted.
In that case I'm perplexed too! You ought to re-post to pgsql-general -
that list is a *lot* more active than this one, so you'd have a better
chance of having your problem solved.
Ray.
---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pg_connect fails, pgsql works
2008-03-10 17:37 pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
@ 2008-03-11 05:33 ` F. Jovan Jester <jesterj@groupspeak.com>
2008-03-11 13:59 ` Re: pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
2 siblings, 1 reply; 7+ messages in thread
From: F. Jovan Jester @ 2008-03-11 05:33 UTC (permalink / raw)
To: John Cartwright <John.C.Cartwright@noaa.gov>; +Cc: pgsql-php
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
> "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
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pg_connect fails, pgsql works
2008-03-10 17:37 pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-11 05:33 ` Re: pg_connect fails, pgsql works F. Jovan Jester <jesterj@groupspeak.com>
@ 2008-03-11 13:59 ` John Cartwright <John.C.Cartwright@noaa.gov>
0 siblings, 0 replies; 7+ messages in thread
From: John Cartwright @ 2008-03-11 13:59 UTC (permalink / raw)
To: F. Jovan Jester <jesterj@groupspeak.com>; +Cc: pgsql-php
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* <John.C.Cartwright@noaa.gov
> <mailto: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
> <http://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
> <mailto:pgsql-php@postgresql.org>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-php
>
>
>
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pg_connect fails, pgsql works
2008-03-10 17:37 pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
@ 2008-03-11 13:32 ` Frank Bax <fbax@sympatico.ca>
2 siblings, 0 replies; 7+ messages in thread
From: Frank Bax @ 2008-03-11 13:32 UTC (permalink / raw)
To: pgsql-php
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?
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2008-03-11 13:59 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-03-10 17:37 pg_connect fails, pgsql works John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-10 18:44 ` Raymond O'Donnell <rod@iol.ie>
2008-03-10 20:06 ` John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-10 20:10 ` Raymond O'Donnell <rod@iol.ie>
2008-03-11 05:33 ` F. Jovan Jester <jesterj@groupspeak.com>
2008-03-11 13:59 ` John Cartwright <John.C.Cartwright@noaa.gov>
2008-03-11 13:32 ` Frank Bax <fbax@sympatico.ca>
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