从ubuntu服务器调用我的php脚本时出现此错误。我使用apt get安装了php5-pgsql,但错误仍然存在。以下是我的源代码,请提供帮助。
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$host = "localhost";
$port = "5432";
$user = "postgres";
$pass = "root";
$db = "quickbed";
$con = pg_connect("host=$host port=$port dbname=$db user=$user password=$pass") or die ("Could not connect to server\n");
$query = "select * from tbl_hosts, (select count(*) from tbl_hosts) as cnt order by registration_time";
$rs = pg_query($con, $query) or die("Cannot execute query: $query\n");
$rows['spaces'] = pg_fetch_all($rs);
echo json_encode($rows);
pg_close($con);
?>