Re: pg_connect socket creation error (0x0000273F) - Mailing list pgsql-php

From scott.marlowe
Subject Re: pg_connect socket creation error (0x0000273F)
Date
Msg-id Pine.LNX.4.33.0401121604070.20581-100000@css120.ihs.com
Whole thread Raw
In response to pg_connect socket creation error (0x0000273F)  (Douglas Douglas <replaceafi11@yahoo.es>)
List 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.


pgsql-php by date:

Previous
From: Douglas Douglas
Date:
Subject: pg_connect socket creation error (0x0000273F)
Next
From: Michael Hanna
Date:
Subject: Selecting from two tables