Re: unable to connect to pgsql server

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: pgsql-php(at)postgresql(dot)org
Subject: Re: unable to connect to pgsql server
Date: 2004-05-26 13:50:06
Message-ID: 5.2.1.1.0.20040526091656.02306cb0@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

At 01:02 PM 5/25/04, Keary Suska wrote:

>on 5/24/04 2:59 PM, fbax(at)sympatico(dot)ca purportedly said:
>
> > I couldn't figure out OpenBSD options for netstat. Do these prove the same
> > thing?
> > # netstat -l | grep 5432
> > 0xd187f7d8 stream 0 0 0xe8844498 0x0 0x0 0x0
> > /tmp/.s.PGSQL.5432
>
>You could probably do this:
># netstat -ln | grep 5432
>
>Which should show two entries--one for TCP/IP, one for Unix Domain Socket.

# netstat -ln | grep 5432
tcp 0 0 192.168.1.90.29958 192.168.1.90.5432 TIME_WAIT
0xd187f7d8 stream 0 0 0xe8844498 0x0 0x0 0x0
/tmp/.s.PGSQL.5432

> > # fstat | head -n 1 ; fstat | grep 5432
> > USER CMD PID FD MOUNT INUM MODE R/W DV|SZ
> > _pgsql postgres 5444 3* internet stream tcp 0xd18729dc *:5432
>
>I am not familiar with this command, but it seems to be saying that you have
>a listening connection on the right port.
>
>Some other questions:
>
>1) If you use the IP instead of host name, do you get the same effect?

First I got error about ip not in pg_hba.conf, so I added
host all all 192.168.1.90 255.255.255.255 trust
- when I fixed that and rebooted, the system works!!! I then removed the
above line, rebooted and tried host=127.0.0.1 in pg_connect instead of
host=localhost and that works too! So why doesn't host=localhost work?

>2) Have you tried not specifying a host--in which case the Unix domain
>socket will be used--and does it work?

It doesn't work - but different error.

PHP Warning: pg_connect(): Unable to connect to PostgreSQL server: could
not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket &quot;/tmp/.s.PGSQL.5432&quot;?
in /php/class/phplib-7.4/db_pgsql.inc on line 51

I think I know what's causing this problem - apache is running with "chroot
/var/www" - a change in default install sometime between OpenBSD 2.9 and
3.5 - could this also be causing the problem with tcpip socket?

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Keary Suska 2004-05-26 22:06:51 Re: unable to connect to pgsql server
Previous Message Keary Suska 2004-05-25 17:02:30 Re: unable to connect to pgsql server