Re: unable to connect to pgsql server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



on 5/26/04 7:50 AM, fbax@xxxxxxxxxxxx purportedly said:

> 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?

It very well could be. They way to know is to try it sans chroot. If it
works, the next headache is trying to figure out what precisely is causing
the problem. From what I have heard, using Apache with chroot is such a pain
in the ass that most security conscious admins don't think it's worth the
effort.

But if you are set on using chroot: First, you should ldd the PHP binary and
make sure all libs are in the chroot space. Also, ldd each lib and make sure
any libs they call are in as well. Second, make sure any DNS resolving files
are also in the chroot space. I am not sure which ones are needed, but
usually at least the hosts file and resolv.conf.

Good luck,

Keary Suska
(719) 473-6431
(719) 440-9952 (cell)



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux