I am new to postgreSQL and web development and lately I tried to connect my previously created database via PHP. But things didn't worked out, I get the password authentication failed for the user postgres. I've been looking everywhere but can't find anything to solve this issue.
The database is hosted on my iMac, port 5432 and php script on heliohost.org which will be used later on to query the database.
Here is my php script:
<?php
$host = "host=127.0.0.1";
$port = "port=5432";
$dbname = "dbname=osm";
$credentials = "user=postgres password=newPassword";
$db = pg_connect( "$host $port $dbname $credentials" );
if(!$db){
echo "Error : Unable to open database\n";
} else {
echo "Opened database successfully\n";
}
?>
My pg_hba.conf looks like this :
local all postgres md5
and my postgresql.conf has : listen_addresses = localhost
I am a bit confused with this, if anyone have suggestion to get this up and running.
Thanks everyone!