php - Unable to connect to PostgreSQL server -
i'm trying connect postgresql database of app on heroku:
$host = "ec2-54-235-242-31.compute-1.amazonaws.com"; $username = "user"; $password = "pass"; $database = "dbname"; $port = "5432"; $dbconn = pg_connect("host=".$host." port=".$port ." dbname=".$database." user=".$username." password=".$password) or die('could not connect: ' . pg_last_error());
but i'm getting error:
warning: pg_connect() [function.pg-connect]: unable connect postgresql server: fatal: no pg_hba.conf entry host "69.196.177.196", user "user", database "dbname", ssl off in d:\wamp\www\heroku_app\test.php on line 53
what problem here? how can fix it?
note: happens when run on local machine (via wamp server). if deploy heroku runs fine
the key error here ssl off
. heroku postgres requires ssl external connections. make sure php compiled ssl , specify in connection sslmode=require
.
Comments
Post a Comment