X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 395B9D1CCCD for ; Mon, 12 Jan 2004 23:26:47 +0000 (GMT) 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 91177-08 for ; Mon, 12 Jan 2004 19:26:18 -0400 (AST) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 39492D1B432 for ; Mon, 12 Jan 2004 19:26:15 -0400 (AST) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.10/8.12.10) with ESMTP id i0CNPW0d008129; Mon, 12 Jan 2004 16:25:32 -0700 (MST) Date: Mon, 12 Jan 2004 16:07:34 -0700 (MST) From: "scott.marlowe" To: =?iso-8859-1?q?Douglas=20Douglas?= Cc: Subject: Re: pg_connect socket creation error (0x0000273F) In-Reply-To: <20040112224607.26249.qmail@web80808.mail.yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IHS-MailScanner: Found to be clean X-IHS-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/10 X-Sequence-Number: 2526 On Mon, 12 Jan 2004, Douglas Douglas wrote: > Hello. > > I've been fighting with this all day, trying to fix it but I > couldn't. So here I am. I have Cygwin installed in a Win XP machine. > PostgreSQL is running there. Apache and PHP are installed in Windows > in the same computer. PostgreSQL is properly configured (even psql > and pgAdmin III work). > > Since I've heard that sockets are more efficient that connecting to > localhost, I decided to uncomment the lines: > tcpip_socket = true > port = 5432 > in the postgresql.conf file. > > But when I removed the host parameter from the connection string: > pg_connect('dbname=mydb user=myuser password=mypass') > > I got this message: > Warning: pg_connect(): Unable to connect to PostgreSQL server: could > not create socket: An address incompatible with the requested > protocol was used. (0x0000273F) . in c:\htdocs\testsockets.php on > line 2 I'm pretty sure you're confusing unix domain sockets with tcpip_sockets, which aren't the same thing. By default, postgresql only answers on unix sockets, and tcpip has to be turned on. PHP uses unix sockets if you DON'T express a host name in the connect string, but when you do, it switches to tcpip sockets. So, your tcpip_socket = true turns on tcpip while removing the host parameter from pg_connect makes it try to connect via local unix sockets. I don't think cygwin supports local unix sockets, but don't quote me on that. The performance difference is pretty small, if any, so don't worry too much about it, just find a config that works and you're gold.