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

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: Shankar Palaniappan <shankar(dot)palaniappan(at)gmail(dot)com>
Subject: Re: Re: Unable to connect to PostgreSQL server : Could not get socket error status
Date: 2011-12-23 14:51:41
Message-ID: 201112230651.41468.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Friday, December 23, 2011 1:32:49 am Shankar Palaniappan wrote:

> 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.

Some questions:
1) What is the connection string are you using for psql?
2) How are you connecting in each case(PHP,psql), remotely or locally?
3) What is listen_addresses set to in postgresql.conf?

>
> <?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";
> }
>
> ?>

--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2011-12-23 15:00:13 Re: Initdb fails on openwrt in "creating template1 database"
Previous Message Adrian Klaver 2011-12-23 14:42:54 Re: Initdb fails on openwrt in "creating template1 database"