Re: Unable to connect to PostgreSQL server : Could not get socket error status - Mailing list pgsql-general

From Shankar Palaniappan
Subject Re: Unable to connect to PostgreSQL server : Could not get socket error status
Date
Msg-id 854da474-ece1-4a04-b68a-493a1d71c9ba@v24g2000prn.googlegroups.com
Whole thread Raw
In response to Unable to connect to PostgreSQL server : Could not get socket error status  (Shankar Palaniappan <shankar.palaniappan@gmail.com>)
Responses Re: Re: Unable to connect to PostgreSQL server : Could not get socket error status
List pgsql-general
On Dec 22, 11:12 pm, pie...@hogranch.com (John R Pierce) wrote:
> On 12/22/11 1:31 AM, Shankar Palaniappan wrote:
>
> > I am getting the following error when I try to connect from PHP with
> > PostgreSQL server.
> > Operating System is HP-UX and I was able to connect through PostgreSQL
> > server from psql,
>
> what postgres connection parameters are you passing to the php
> connection function?  if you specified host=localhost, or some such,
> then on psql use -h localhost to simulate this.
>
> --
> john r pierce                            N 37, W 122
> santa cruz ca                         mid-left coast
>
> --
> Sent via pgsql-general mailing list (pgsql-gene...@postgresql.org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general


Hi John,

Thanks for your response.

I am able to connect to the database through psql command. Please find
the commands that I have tried through PHP and no success for past 3
days.
Please let me know whether you can help me in this issue.

<?php
ini_set('track_errors','on');
// attempt a connection
$dbh = pg_connect("host=/tmp/ dbname=test_tool port=5495 user=apache
password=apache connect_timeout=20");
// $dbh = pg_connect("host=localhost port=5495 dbname=test_tool");
// $options = " host='localhost' port='5495' user='gls' password=''
dbname='test_tool' ";
// $dbh=pg_connect($options);
if (!$dbh) {
    die("Error in connection: " . pg_last_error($dbh));
print_r($dbh);
}

else
{
echo "Connection is success";
}

?>

pgsql-general by date:

Previous
From: Gavin Flower
Date:
Subject: Re: PostgreSQL DBA in SPAAAAAAAACE
Next
From: Aman Gupta
Date:
Subject: postgresql triggers - defining a global resource (java)