The PHP is connecting to an AWS PostgreSQL 11.5 database from the web server. It has the same VPC's as the one I am trying to connect to.
Here is the PHP code that works when connecting to the database from local machine:
$db = pg_connect( "$host $port $dbname $credentials" );
if(!$db) {
echo "Error : Unable to open database\n";
} else {
echo "Opened database successfully\n";
}
When the php is loaded from the web browser, it displays:
"Error : Unable to open database"
How can I fix this issue?