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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -