Re: [GENERAL] Unable to connect to Postgresql - Mailing list pgsql-general

From Adrian Klaver
Subject Re: [GENERAL] Unable to connect to Postgresql
Date
Msg-id e2b6c867-72c0-f848-9712-4f2629745172@aklaver.com
Whole thread Raw
In response to Re: [GENERAL] Unable to connect to Postgresql  (John Iliffe <john.iliffe@iliffe.ca>)
Responses Re: [GENERAL] Unable to connect to Postgresql  (John Iliffe <john.iliffe@iliffe.ca>)
List pgsql-general
On 04/09/2017 11:33 AM, John Iliffe wrote:
> On Saturday 08 April 2017 18:10:35 Joe Conway wrote:
>> On 04/08/2017 01:23 PM, John Iliffe wrote:
>>> On Saturday 08 April 2017 09:38:07 Adrian Klaver wrote:
>>>> So what if you change the connection to use -h localhost?
>>>
>>> Can you please expand on that request?  I'm not sure where you want me
>>> to put that directive.  I'm using the mod_php module in Apache.
>>
>> See the second example here:
>>
>> http://php.net/manual/en/function.pg-connect.php
>>
>> 8<-------------
>> $dbconn2 = pg_connect("host=localhost port=5432 dbname=mary");
>> // connect to a database named "mary" on "localhost" at port "5432"
>> 8<-------------
>>
>> That will try to use a tcp connection on localhost instead of a unix
>> socket.
>>
> Thanks Joe.  I Changed the pg_connect line in the script to:
>
> --------------------------
>   $db_handle = pg_connect('dbname=yrarc host=192.168.1.6 port=5432
> user=xxxx password=xxxxxx');
> ---------------------------

So is this on the machine that has the Postgres server?

If not change to that machine and use host=localhost, otherwise just
change to host=localhost.

>
> Even though "localhost" is in the /etc/hosts file the lookup failed to
> resolve so I provided the full IP address.  The error from Apache is:

Can you show us the /etc/host file?



--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: [GENERAL] Unable to connect to Postgresql
Next
From: John Iliffe
Date:
Subject: Re: [GENERAL] Unable to connect to Postgresql