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 9b3ca09e-4cf3-bcda-ae45-488131e4a27a@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 05:30 PM, John Iliffe wrote:
> On Sunday 09 April 2017 20:01:32 Adrian Klaver wrote:

>> So the issue is in PHP via Apache using the socket, because if I
>> remember right you used localhost in the Apache/PHP combination and it
>> worked, correct?
>
> Yes.
>
> I think there is some confusion here, might be on my part, I don't know.
>
> There is a network connection from 192.168.1.10 to 192.168.1.6 to Apache
> and then there should be a connection from Apache on using localhost (or
> 127.0.0.1) to Postgresql.  So shouldn't that be sufficient?  Other than the
> original error on my part, coding the server's external address
> (192.168.1.6) in the db_connect() call which is now fixed, shouldn't the
> pg_hba host address  line be 127.0.0.1/32 ?

Yes, Apache is connecting to Postgres on the same machine so localhost
should be sufficient for IP purposes.

Not sure that it applies here, but what does ifconfig show?

>
> Anyhow, that is working properly now.  The domain socket doesn't have an
> explicit address (for 'local') as it is on the current machine as far as I
> understand.
>
> Am I correct?

Correct. The issue is then why psql and stand alone PHP can see the
domain socket while PHP through Apache does not. Not sure why that is at
the moment. Hmm, had a thought. What user is Apache running as and does
that user have permissions on the socket file(s)?

>
> John
>>
>>>> Report back.
>>>>
>>>>> Based on the reference that Joe sent earlier, I do have a second
>>>>> domain socket on /var/pgsql but the problem is how do I get PHP to
>>>>> look there? There isn't any config file for mod_php and php-fpm has
>>>>> one but the location of the domain socket is the default -
>>>>> /tmp/.s.......
>>>>>
>>>>> I don't think this is the problem if this list unless someone
>>>>> happens to know the solution.  If not, then thank you for all the
>>>>> work, and especially for the promptness of the responses.   I'm not
>>>>> at all sure that I could have figured this out by myself.
>>>>>
>>>>> John
>


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: rob stone
Date:
Subject: Re: [GENERAL] Unable to connect to Postgresql
Next
From: Günce Kaya
Date:
Subject: Re: [GENERAL] [ADMIN] calculating table and index size