pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Keary Suska <hierophant@pcisys.net>
To: Postgres-PHP <pgsql-php@postgresql.org>
Subject: Re: unable to connect to pgsql server
Date: Wed, 26 May 2004 16:06:51 -0600
Message-ID: <BCDA711B.1139C%hierophant@pcisys.net> (raw)
In-Reply-To: <5.2.1.1.0.20040526091656.02306cb0@pop6.sympatico.ca>

on 5/26/04 7:50 AM, fbax@sympatico.ca 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 &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?

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)




view thread (7+ messages)

Message-ID: <BCDA711B.1139C%hierophant@pcisys.net>
Permalink:  ../BCDA711B.1139C%25hierophant@pcisys.net/
Also on:    postgresql.org/message-id/BCDA711B.1139C%hierophant@pcisys.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: hierophant@pcisys.net
  Subject: Re: unable to connect to pgsql server
  In-Reply-To: <BCDA711B.1139C%hierophant@pcisys.net>
  References: <5.2.1.1.0.20040526091656.02306cb0@pop6.sympatico.ca> <BCDA711B.1139C%hierophant@pcisys.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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