How Do You Troubleshoot a PHP Error “call to undefined function pg_connect()” So Your Script Can Log into a Postgres Database?

Problem scenario
You are trying to use a .php script on the back end to connect to your PostgreSQL database.  However, you get an error like this when you try to run it:  'PHP Fatal error:  Call to undefined function pg_connect() in '

Solution
Install php5-pgsql.  For Ubuntu you would run a command like this:  sudo apt-get install php5-pgsql

Leave a comment

Your email address will not be published.