X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2AF1352902 for ; Wed, 15 Jun 2005 23:38:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00319-06 for ; Thu, 16 Jun 2005 02:38:44 +0000 (GMT) Received: from smtp.duo-county.com (smtp.duo-county.com [66.38.0.221]) by svr1.postgresql.org (Postfix) with ESMTP id DA7D5528D9 for ; Wed, 15 Jun 2005 23:38:40 -0300 (ADT) Received: from localhost.localdomain (15-130.mod.duo-county.com [66.38.15.130]) by bn9.blue.net (8.12.10/8.12.10/SMTP) with ESMTP id j5G2cbxE012705; Wed, 15 Jun 2005 21:38:38 -0500 (CDT) Received: from dlb by localhost.localdomain with local (Exim 4.50) id 1DijgW-0000dn-N9; Wed, 15 Jun 2005 21:00:48 -0500 Date: Wed, 15 Jun 2005 21:00:48 -0500 To: Tom Lane Cc: David , pgsql-admin@postgresql.org Subject: Re: Connecting via localhost pg-8.0.3 Message-ID: <20050616020048.GA1912@localhost.localdomain> Mail-Followup-To: Tom Lane , David , pgsql-admin@postgresql.org References: <20050615022603.GA1615@localhost.localdomain> <27553.1118805754@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <27553.1118805754@sss.pgh.pa.us> User-Agent: Mutt/1.5.9i From: David X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.114 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200506/104 X-Sequence-Number: 17859 On Tue, Jun 14, 2005 at 11:22:34PM -0400, Tom Lane wrote: > David writes: > > I've just upgraded from 7.4.7 to 8.0.3. >=20 > On what platform, and how did you build or obtain each of these PG > versions? Oops - thought I included that but apparently didn't.. Platform is Debian. The packages come from The Debian repositories. > > I get the following error if I omit "host=3Dlocalhost" : >=20 > > Warning: pg_connect(): Unable to connect to PostgreSQL server: could > > not connect to server: =B8^@Hv@' Is the server running locally and > > accepting connections on Unix domain socket > > "/var/run/postgresql/.s.PGSQL.5432"? in > > /home/dlb/public_html/test.php > > on line 2 >=20 > The junk text where a kernel error message ought to be is a known > problem with some older RPM distributions (if running in a non-C > locale) but I thought it was fixed in all known 8.0.3 packagings. > So I'm a tad interested to find where your 8.0.3 came from. >=20 > As far as actually solving your problem: it's a good guess that > the problem is a confusion about where the Postgres server socket > lives. The error message shows that the client library is looking > in /var/run/postgresql/, but the normal default for this is /tmp/. > Do you see a socket file at /tmp/.s.PGSQL.5432 ? If so then you > have a libpq.so that came from a different build than the server > came from, and the ultimate answer is to get those two components > in sync. Well, you guessed correctly. It was a configuration problem. By inserting the line: unix_socket_directory =3D '/var/run/postgresql' into postgresql.conf, it works as expected. I must confess that I was a bit unclear about the connection parameters. I thought that (in php) "host=3Dlocalhost" meant to use sockets, but this means connect through TCP/IP over lo, correct? > It could well be that both of the above points are explained if > your PHP is linking to an old version of libpq.so that doesn't > match your PG server. I'd wondered if this could have been it, but apparently all appears to be satisfactory now. Thanks for the reply. It got me headed in the right direction.