Adding PostgreSQL support to already installed PHP

I had a similar problem earlier on today on Windows. I couldn't access "Phppgadmin". Whenever I tried to access it I get this error: "Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option". So I did some search which got me here.

Anyway, I was able find a way around the problem using the instruction I found here as follows:

  1. Browsed to the php.ini file found in C:\xampp\php\php.ini and opened it in text editor as an administrator
  2. Uncommented the following by removing the semicolons prefexing; extension_dir="C:\xampp\php\ext", extension=php_pgsql.dll and extension=php_pgsql.dll
  3. Saved the file and restarted Apache

Here's what solved the issue for me (on Windows, using WAMPSERVER):

  • Uncomment extension=php_pgsql.dll and extension=php_pdo_pgsql.dll in php.ini
  • Restart all services in WAMPSERVER
  • Make sure that php_pgsql and php_pdo_pgsql are checked in the WAMPSERVER menu -> PHP -> PHP extensions
  • In httpd.conf add the line LoadFile "C:/Program Files/PostgreSQL/9.4/bin/libpq.dll" before the line LoadModule php5_module "c:/wamp/bin/php/php5.5.12/php5apache2_4.dll"
  • Restart all services again and check that the WAMPSERVER icon becomes green.

Source: http://toolkt.com/site/install-postgresql-and-phppgadmin-in-windows-with-wamp/


Run yum install php-pgsql php-pdo_pgsql to install the PHP Postgres package.

Tags:

Php

Postgresql