X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 4F9ABD1B503 for ; Wed, 26 May 2004 19:07:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 79683-10 for ; Wed, 26 May 2004 19:07:01 -0300 (ADT) Received: from krusty.pcisys.net (unknown [216.229.32.178]) by svr1.postgresql.org (Postfix) with ESMTP id 32EDBD1B241 for ; Wed, 26 May 2004 19:06:50 -0300 (ADT) Received: from [192.168.0.6] (moe.rbe45-144.cos.pcisys.net [216.229.45.144]) (authenticated bits=0) by krusty.pcisys.net (8.12.10/8.12.10) with ESMTP id i4QM6pJw012461 for ; Wed, 26 May 2004 16:06:52 -0600 (MDT) User-Agent: Microsoft-Entourage/10.1.4.030702.0 Date: Wed, 26 May 2004 16:06:51 -0600 Subject: Re: unable to connect to pgsql server From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: <5.2.1.1.0.20040526091656.02306cb0@pop6.sympatico.ca> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/52 X-Sequence-Number: 2771 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 "/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)