I'm cant connect to PostgreSQL with php code. My Postgresql is docker container. I get an IP with:
docker inspect toshi_db_1
How I'm trying to connect:
$dbconn = pg_connect("host=172.17.0.2 port=5432 dbname=toshi_development")or die("Could not connect");
Error: Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection timed out (0x0000274C/10060) Is the server running on host "172.17.0.2" and accepting TCP/IP connections on port 5432?
I thought there could be problems in PostgreSQL.conf with listen_address configuration parameter, but it allows all connections, so I have no idea where the problem is.
UPDATE: I fixed it myself, just tried to expose wrong port in docker-compose file.
docker-composer?