pg_connect(): Unable to connect to PostgreSQL server

33 views
Skip to first unread message

Kirtan Thaker

unread,
Dec 14, 2017, 9:04:50 AM12/14/17
to Google App Engine
Hello Guys,

I have deployed an application on Google App Engine. It is developed using PHP and PostgreSQL.

It works on localhost but when try to run it on GAE, I receive this error "pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection timed out Is the server running on host "35.198.153.101" and accepting TCP/IP connections on port 5432?".

Please let me know if anyone has solution.

Thanks
Kirtan

George (Cloud Platform Support)

unread,
Dec 14, 2017, 12:06:45 PM12/14/17
to Google App Engine
Hello Kirtan, 

Is the PostgreSQL instance running in the cloud platform as Cloud SQL for PostgreSQL, or in the compute engine environment? Is it external to the GCP? 

It may be worthwhile checking the postgresql.conf file and make sure that listen_addresses is not set to localhost. 

How did you configure client identification in the pg_hba.conf file? You may gather related information on "The pg_hba.conf File" documentation page


Reply all
Reply to author
Forward
0 new messages