title: Fatal error: Uncaught Error: Call to undefined function pg_connect()
body: <p>I am getting this error when calling my php script from ubuntu server. I have installed php5-pgsql using apt get but the error is still persisting. Below is my source code, kindly assist.</p>
  
  <pre><code>&lt;?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);
  
  ?&gt;
  </code></pre>