I tried to test connection using php and database postgresql using below codes:
But I got message error like this:
pg_connect(): Unable to connect to postgreSQL server: FATAL: Ident authentication failed for user "postgres"
<?php
$connect = pg_connect("host=localhost port=5432 dbname=mydb user=postgres password=mypass");
if(!$connect)
{
$error = error_get_last();
echo $error['message'];
}
else
{
echo "Connected";
}
?>
can someone help me please. btw I Using Centos 7.2