daskunk Posted March 23, 2018 Posted March 23, 2018 I was trying to figure this out on my own by reading various posts and I'm not sure if the problem is on my side or not. I recently created a Postgresql database and now I'd like to access it through a PHP script from my heliohost web site.The pg_connect call in my PHP script looks like $result=pg_connect("host=ricky.heliohost.org port=5432 dbname=daskunk_DaSkunkWorksPBC user=daskunk_php password=*****");I'm getting this responseWarning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "64.62.211.134", user "daskunk_php", database "daskunk_DaSkunkWorksPBC", SSL off in /home/daskunk/public_html/pbc/psql.php on line 11I've seen some posts indicating remote access is disabled by default and we have to ask your support team to enable it. My infoDatabase: daskunk_DaSkunkWorksPBCUser: daskunk_phpDomain: daskunk.heliohost.orgServer: rickyAny help in resolving this is greatly appreciated. Thank you in advance.
Krydos Posted March 23, 2018 Posted March 23, 2018 Does it work if you use localhost instead of ricky.heliohost.org?
daskunk Posted March 24, 2018 Author Posted March 24, 2018 (edited) I tried both $connessione=pg_connect("host=localhost dbname=daskunk_DaSkunkWorksPBC user=daskunk_php password=<removed>") or die("Database non disponibile"); which resulted in Warning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "::1", user "daskunk_php", database "daskunk_DaSkunkWorksPBC", SSL off in /home/daskunk/public_html/pbc/psql.php on line 12 and $connessione=pg_connect("host=localhost.heliohost.org dbname=daskunk_DaSkunkWorksPBC user=daskunk_php password=<removed>") or die("Database non disponibile"); which resulted in Warning: pg_connect(): Unable to connect to PostgreSQL server: could not translate host name "localhost.heliohost.org" to address: Name or service not known in /home/daskunk/public_html/pbc/psql.php on line 12 So if neither is correct syntax, can someone please help with the correct syntax. Otherwise is one of them is correct usage of localhost, then that is not working either. I would really like to get my postgresql db working from my web site. Thank you Edited March 24, 2018 by Krydos removed password
Krydos Posted March 24, 2018 Posted March 24, 2018 The second one will never work because localhost.heliohost.org doesn't exist, and if it did it would be a user's account. Does the first one work now?
daskunk Posted March 24, 2018 Author Posted March 24, 2018 Reverted back to the first one and tried again.$dbconn=pg_connect("host=localhost port=5432 dbname=daskunk_DaSkunkWorksPBC user=daskunk_php password=*****") Still getting this errorWarning: pg_connect(): Unable to connect to PostgreSQL server: FATAL: no pg_hba.conf entry for host "::1", user "daskunk_php", database "daskunk_DaSkunkWorksPBC", SSL off in /home/daskunk/public_html/pbc/psql.php on line 12
daskunk Posted March 24, 2018 Author Posted March 24, 2018 Oh and I tried with and without the Port=5432 ... same result either way. Thanks
Krydos Posted March 24, 2018 Posted March 24, 2018 $dbconn=pg_connect("host=localhost port=5432 dbname=daskunk_DaSkunkWorksPBC user=daskunk_php password=*****")I tried that exact same code with my Ricky account, and it works perfectly. What is the link to your script?
daskunk Posted March 24, 2018 Author Posted March 24, 2018 Thank you for trying it out. This is what I'm calling from my browser https://daskunk.heliohost.org/pbc/psql.php
daskunk Posted March 24, 2018 Author Posted March 24, 2018 THANK YOU SO MUCH! When I initially created the daskunk_php userid (weeks ago now) it was my first time working with the Postgresql admin tools and I could've sworn I not only created the user id but added it to the database. I went through and tried adding it again just now, and it says it was submitted successfully. So now when I run the php script I'm past the pg_connect error and on my way with actual queries!! I can't tell you how much I appreciate your help. Thank you again.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now