connect to postgres server without internet connection with php script

Started by Reynard Hilmanabout 23 years ago4 messagesgeneral
Jump to latest
#1Reynard Hilman
reynardmh@lightsky.com

Hi everyone,

Is it possible to connect to a postgres server without TCP/IP connection
from a php script (ie: using unix domain socket) ?
If php cannot do this, do I have to use libpq C library? or is there any
other way to do it?

thanks,
- reynard

#2scott.marlowe
scott.marlowe@ihs.com
In reply to: Reynard Hilman (#1)
Re: connect to postgres server without internet connection

On Mon, 31 Mar 2003, Reynard Hilman wrote:

Hi everyone,

Is it possible to connect to a postgres server without TCP/IP connection
from a php script (ie: using unix domain socket) ?
If php cannot do this, do I have to use libpq C library? or is there any
other way to do it?

On the same box, yes. Just don't include a host entry in your connect
function:

$conn = pg_connect("user=bubba dbname=bo_bob_brain");

should work.

#3Thomas Beutin
tyrone@laokoon.IN-Berlin.DE
In reply to: Reynard Hilman (#1)
Re: connect to postgres server without internet connection with php script

Hi,

On Mon, Mar 31, 2003 at 03:44:36PM -0500, Reynard Hilman wrote:

Is it possible to connect to a postgres server without TCP/IP connection
from a php script (ie: using unix domain socket) ?

Yes, php its doing this by default (no hostname in the connect string)
on my linux box.

Greetings,
-tb
--
Thomas Beutin tb@laokoon.IN-Berlin.DE
Beam me up, Scotty. There is no intelligent live down in Redmond.

#4Reynard Hilman
reynardmh@lightsky.com
In reply to: Thomas Beutin (#3)
Re: connect to postgres server without internet connection

Yes, php its doing this by default (no hostname in the connect string)
on my linux box.

Greetings,
-tb

Yes, it works. I didn't expect the answer is that simple.
thanks everyone,

- reynard