Skip site navigation (1) Skip section navigation (2)

Re: pg_connect socket creation error (0x0000273F)

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Douglas Douglas <replaceafi11(at)yahoo(dot)es>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: pg_connect socket creation error (0x0000273F)
Date: 2004-01-12 23:07:34
Message-ID: Pine.LNX.4.33.0401121604070.20581-100000@css120.ihs.com (view raw or flat)
Thread:
Lists: pgsql-php
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.


In response to

pgsql-php by date

Next:From: mauro.folcarelliDate: 2004-01-14 14:42:32
Subject: pg_connect(): Cannot create new link
Previous:From: Douglas DouglasDate: 2004-01-12 22:46:07
Subject: pg_connect socket creation error (0x0000273F)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group