pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_connect problem
3+ messages / 3 participants
[nested] [flat]
* pg_connect problem
@ 2003-09-03 17:36 Edric Bulalacao <egb@tonesoft.com>
0 siblings, 1 reply; 3+ messages in thread
From: Edric Bulalacao @ 2003-09-03 17:36 UTC (permalink / raw)
To: pgsql-php
I’m a PHP/PostGRE newbie. I’m getting this error:
Warning: pg_connect(): Unable to connect to PostgreSQL server: could not
connect to server: Connection refused Is the server running on host
localhost and accepting TCP/IP connections on port 5432? . in
/export/home/tsc/a/delete-action.phtml on line 156
Couldn't make a connection!
This is the code I’m trying to run:
$connection = pg_connect("host=localhost dbname=address user=address
password=address");
This is my pg_hba.conf
local all all password
This is the output of “netstat –an | grep 5432”
unix 2 [ ACC ] STREAM LISTENING 27649 /tmp/.s.PGSQL.5432
I’m able to do “psql –u address” and supply and username and password as any
Unix user defined in the system.
Can anyone tell me what I’m doing wrong? Thanks.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pg_connect problem
@ 2003-09-03 18:00 nzegarra@kolareal.net
parent: Edric Bulalacao <egb@tonesoft.com>
0 siblings, 0 replies; 3+ messages in thread
From: nzegarra@kolareal.net @ 2003-09-03 18:00 UTC (permalink / raw)
To: pgsql-php
in your pg_hba.conf must set a line with the follow:
local all all 127.0.0.1 255.255.255.255 trust
local all all IP.OF.YOUR.MACHINE YOUR.GATEWAY trust
and in your postgresql.conf must set the port = 5432 without the comment
restart the postgresql and it must work
Regards
Nilson
> I’m a PHP/PostGRE newbie. I’m getting this error:
>
> Warning: pg_connect(): Unable to connect to PostgreSQL server: could not
> connect to server: Connection refused Is the server running on host
> localhost and accepting TCP/IP connections on port 5432? . in
> /export/home/tsc/a/delete-action.phtml on line 156
> Couldn't make a connection!
>
> This is the code I’m trying to run:
> $connection = pg_connect("host=localhost dbname=address user=address
> password=address");
>
> This is my pg_hba.conf
> local all all password
>
> This is the output of “netstat –an | grep 5432”
> unix 2 [ ACC ] STREAM LISTENING 27649
> /tmp/.s.PGSQL.5432
>
> I’m able to do “psql –u address” and supply and username and password as
> any
> Unix user defined in the system.
>
>
> Can anyone tell me what I’m doing wrong? Thanks.
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pg_connect problem
@ 2003-09-03 18:00 Robby Russell <rrussell@commandprompt.com>
0 siblings, 0 replies; 3+ messages in thread
From: Robby Russell @ 2003-09-03 18:00 UTC (permalink / raw)
To: pgsql-php
Edric Bulalacao wrote:
> Thank you for the quick reply. Looks like all the lines in my
> postgresql.conf file are all commented out.
>
> I will uncomment the tcpip_socket and port lines lines to see if it works:
>
>
No problem. I've run into this on several occasions when I'm setting up
a new server and forget to make that one minor little change. It's a
good default security setting, however it adds one extra little step for
us. heh
-Robby
> # Connection Parameters
> #
> #tcpip_socket = true
> #ssl = false
>
> #max_connections = 32
> #superuser_reserved_connections = 2
>
> #port = 5432
> #hostname_lookup = false
> #show_source_port = false
>
>
>
> -----Original Message-----
> From: Robby Russell [mailto:rrussell@commandprompt.com]
> Sent: Wednesday, September 03, 2003 10:48 AM
> To: Edric Bulalacao
> Subject: Re: [PHP] pg_connect problem
>
> Edric Bulalacao wrote:
>
>>I'm a PHP/PostGRE newbie. I'm getting this error:
>>
>>Warning: pg_connect(): Unable to connect to PostgreSQL server: could not
>>connect to server: Connection refused Is the server running on host
>>localhost and accepting TCP/IP connections on port 5432? . in
>>/export/home/tsc/a/delete-action.phtml on line 156
>>Couldn't make a connection!
>
>
>>Can anyone tell me what I'm doing wrong? Thanks.
>
>
> Look at your postgres.conf file.
>
> Is TCP/IP on?
>
> tcpip_socket = true
>
>
>
> --
> Robby Russell, | Sr. Administrator / Lead Programmer
> Command Prompt, Inc. | http://www.commandprompt.com
> rrussell@commandprompt.com | Telephone: (503) 222.2783
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-09-03 18:00 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-09-03 17:36 pg_connect problem Edric Bulalacao <egb@tonesoft.com>
2003-09-03 18:00 ` nzegarra@kolareal.net
2003-09-03 18:00 Re: pg_connect problem Robby Russell <rrussell@commandprompt.com>
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