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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Run the following command via SSH (on your Droplet):
sudo ufw status
… to see if ufw is enabled (your firewall, which is standard on Ubuntu 16.x). If it is, you will need to allow the connection through the firewall.
To do this, you’d need to get the Dedicated or Shared IP address from name.com and then run:
sudo ufw allow from NAME_IP to any port 5432
… replace NAME_IP with the IP for your account.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.