Search Postgresql Archives

Re: Unable to connect to Postgresql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx


--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux