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

Re: Can't connect to 7.4 DB

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Michael Hanna <taojones(at)sympatico(dot)ca>
Cc: <pgsql-php(at)postgresql(dot)org>
Subject: Re: Can't connect to 7.4 DB
Date: 2004-02-12 15:30:17
Message-ID: Pine.LNX.4.33.0402120827550.4413-100000@css120.ihs.com (view raw or flat)
Thread:
Lists: pgsql-advocacypgsql-php
OK, here's a little trick you may not be aware of.

pg_connect("dbname=mydb user=stan");

will open a local unix domain socket.

pg_connect("host=127.0.0.1 dbname=mydb user=stan");

will open a local TCP/IP connection on the loopback interface.

In order for this to work, your postgresql.conf must have this line 
changed:
#tcpip_socket = false
to
tcpip_socket = true

and your pg_hba.conf needs a line like this:

host    all         all         127.0.0.1         255.0.0.0   trust

So it's likely the "secure by default" mentality of postgresql that's 
biting you here.


In response to

Responses

pgsql-advocacy by date

Next:From: Joshua DrakeDate: 2004-02-12 15:31:27
Subject: Re: Can't connect to 7.4 DB
Previous:From: scott.marloweDate: 2004-02-12 15:09:12
Subject: Re: I want to use postresql for this app, but...

pgsql-php by date

Next:From: Joshua DrakeDate: 2004-02-12 15:31:27
Subject: Re: Can't connect to 7.4 DB
Previous:From: Michael HannaDate: 2004-02-12 13:36:45
Subject: Can't connect to 7.4 DB

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