Question
Warning: pg_connect(): Unable to connect to PostgreSQL server:
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: pgconnect(): 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*****/publichtml/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
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×