$sudo gedit pgconnect.php(在目录/var/www/下)
<?php
$conn_string = "host=127.0.0.1 port=5432 dbname=baihu user=baihu password=baihu" ;
$dbconn = pg_connect($conn_string);
if (!$dbconn)
echo "\r\n\n\n\n\n\nConnection Failed!!!\r\n";
else
echo "\r\n\n\n\n\n\nConnection Success!!!\r\n";
pg_close($dbconn);
?>
在浏览器中浏览网页: