title: Enable PHP support for postgresql in Ubuntu 11.04 server
body: <p>I've installed Apache2 with php5 support and everything works there.  I've installed PostgreSQL and am able to connect to it using the terminal and execute SQL statements.</p>
  
  <p>PROBLEM: I can't get a working connection between my php scripts and the PostgreSQL database.  I have installed the php5-pgsql packaged from the repositories, but the connection just won't work.</p>
  
  <p>I get the following error message:</p>
  
  <p>PHP Fatal Error: Call to undefined function pg_connect() in /var/www/[myfile].php on line [X]</p>
  
  <p>How do I enable support for PostgreSQL connections in PHP5 in ubuntu 11.04?</p>
  
  <p>EDIT: Checked phpinfo() and found no entries for PostgreSQL.  I don't know why that is so, I DID install php5-pgsql package for ubuntu 11.04.</p>
  
  <p>Here is what worked:  I installed phppgadmin from the Ubuntu repositories.  Not only does this make a nice tool available for me now, it also installed the needed packages for php to connect to postgresql.</p>
  
  <p>After that, it was all in the connection parameters.  It wouldn't connect to the database on the local server until I defined the connection host, port, database, user, and password in that order in pg_connect().</p>
  
  <p>I still don't know why installing php5-pgsql on my own didn't enable PostgreSQL connections from php.  Any input on this would be helpful.</p>