I have downloaded postgress.app as my localhost for postgresql. I
can connect using java through jdbc, but have had problems connecting
through php. When I run the pg_connect(host=localhost, user = xxx,
password = xxx) I receive the error: Is the server running on host
"localhost" (127.0.0.1) and accepting TCP/IP connections on port
I have researched this problem pretty thoroughly and tried all of
1) Uncomment and set listen_addresses = '*' in the postgresql.conf
2) Add host all all "YOUR-IP-ADDRESS"
to the bottom of the pg_hba.conf
3) Set tcpip_socket = true in postgresql.conf file (Now been
4) Delete the postmaster.pid file — psql:
could not connect to server: Connection refused Is the server running
on host "localhost" (::1) and accepting TCP/IP connections
on port 5432?
There has been some discrepancy in exactly what to put in for
"YOUR-IP-ADDRESS" but this article suggests
using ifconfig to check your IP and then using
Even if I change the IP address in the pg_hba.conf file, however,
my error still asks if the IP (127.0.0.1) accepts connections.
A last note: I have tried the method of leaving host blank or
setting the host to a socket path and using a unix domain socket, but
that gave me a whole new set of errors which seemed like a bigger
rabbit hole than solving the TCP/IP.
Any help is much appreciated!