Ubuntu下LAPP(Linux+Apache+PostgreSQL+PHP)环境的配置与安(3)

$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);
?>

在浏览器中浏览网页:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3d2d68c1f6b367001de4e5dd665df716.html