Enable pdo_pgsql (postgres PDO driver) in cpanel server

You can install pdo_pgsql via two methods

1. Via pecl

pecl install pdo_pgsql

If this fails, enable it via manual compilation below

2. Manual compilation

Download the PDO driver from the PECL website below.

http://pecl.php.net/package/PDO_PGSQL

Download it and enter the downloaded directory by

wget http://pecl.php.net/get/PDO_PGSQL-1.0.2.tgz
tar -xzf PDO_PGSQL-1.0.2.tgz
cd PDO-PSQL-1.0.2/

Once this is done, run the standard commands for building a PHP extension.

phpize
./configure
make
make install

Once this is done, you can add the extension to php.ini.

cd /usr/local/lib/
vim php.ini
extension=pdo_pgsql.so

Finally, restart Apache

service httpd restart

Verify it via commandline

php -i | grep pdo_pgsql

Leave a Reply

Your email address will not be published. Required fields are marked *