install dependencies sudo apt-get install php7.0-pgsql
yum install php-pgsql
restart apache
https://stackoverflow.com/questions/38981799/unable-to-install-php5-pgsql-on-ubuntu-16-04/42772824
<?php
$host = "host = hus-west-2.rds.amazonaws.com";
$port = "port = 5432";
$dbname = "dbname = product";
$pass="dElm0zL";
$pid=$argv[1];
$credentials = "user=phone password=$pass";
$db = pg_connect( "$host $port $dbname $credentials" );
if(!$db) {
echo "Error : Unable to open database\n";
} else {
echo "Opened database successfully\n";
}
$sql =<<<EOF
SELECT * FROM public.howardmillerinventory where "Clock"='$pid'
EOF;
$ret = pg_query($db, $sql);
if(!$ret) {
echo pg_last_error($db);
exit;
}
while($row = pg_fetch_row($ret)) {
echo "Item# = ". $row[0] . "\n";
echo "Stock= ". $row[1] ."\n";
}
echo "Operation done successfully\n";
pg_close($db);
?>