Re: Unable to connect to PostgreSQL server : Could not get socket error status

From: Shankar Palaniappan <shankar(dot)palaniappan(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Unable to connect to PostgreSQL server : Could not get socket error status
Date: 2011-12-23 09:32:49
Message-ID: 854da474-ece1-4a04-b68a-493a1d71c9ba@v24g2000prn.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Dec 22, 11:12 pm, pie(dot)(dot)(dot)(at)hogranch(dot)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(dot)(dot)(dot)(at)postgresql(dot)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";
}

?>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Clemens Eisserer 2011-12-23 09:58:38 Re: Initdb fails on openwrt in "creating template1 database"
Previous Message Scott Marlowe 2011-12-23 01:02:01 Re: Initdb fails on openwrt in "creating template1 database"