Re: unable to connect to pgsql server - Mailing list pgsql-php

From Frank Bax
Subject Re: unable to connect to pgsql server
Date
Msg-id 5.2.1.1.0.20040526091656.02306cb0@pop6.sympatico.ca
Whole thread Raw
In response to Re: unable to connect to pgsql server  (Keary Suska <hierophant@pcisys.net>)
Responses Re: unable to connect to pgsql server
List pgsql-php
At 01:02 PM 5/25/04, Keary Suska wrote:

>on 5/24/04 2:59 PM, fbax@sympatico.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 "/tmp/.s.PGSQL.5432"?
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?


pgsql-php by date:

Previous
From: Keary Suska
Date:
Subject: Re: unable to connect to pgsql server
Next
From: Keary Suska
Date:
Subject: Re: unable to connect to pgsql server