Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connect to different postgres servers in php

Status
Not open for further replies.
Jun 15, 1999
18
US
I have a postgres database on 2 different linux servers. the PHP application code resides on one of the servers. I am trying to use pg_connect like this:
****
$conn = pg_connect ("hostaddr=$InServer port=5432 dbname=sag0s01 user=$InUser password=$InPassword");
****
where I pass in the tcpip address of the database server I want to connect to into InServer and the user and password in the other parameters.

When I am connecting to the database on the server where the php code exists, it works fine, but when I try to access the database on the other server I get the following message:
****
Warning: Unable to connect to PostgreSQL server: connectDBStart() -- connect() failed: Connection refused Is the postmaster running (with -i) at 'localhost' and accepting connections on TCP/IP port 5432? in /var/ on line 11

Any help is much appreciated........... Laura
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top