Report this

What is the reason for this report?

Warning: pg_connect(): Unable to connect to PostgreSQL server:

Posted on January 4, 2017

i ve postgreSQL in my droplet ( ip= 139.59.xx.xx ) i can connect it with pgadminIII and valentina studio without problem. https://puu.sh/tblvZ/e6c876ed75.png

but im running php script on my Name.com hosting server and im getting some error

Warning: pg_connect(): Unable to connect to PostgreSQL server: could not connect to server: Connection timed out Is the server running on host “139.59.xx.xx” and accepting TCP/IP connections on port 5432? in /home/f*****/public_html/xxxxx.xxxx.net/new.php on line 2 Error : Unable to open database

here is my php script which is running @ Name.com hosting server to connecto my droplet pgsql( ip= 139.59.xx.xx )

<?php $db = pg_connect(“host=139.59.xx.xx port=5432 dbname=xxxxxxx user=xxxxxx password=xxxxxxxx”); if(!$db){ echo “Error : Unable to open database\n”; } else { echo “Opened database successfully\n”; } ?>

what should i do about it ?

thanks

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.