How to install the PDO_PGSQL driver in ubuntu?


I have already installed PHP 7, Apache 2 and Postgresql 9.5.

I have already enabled the extension in php.ini but it does not work.

In Windows just enable this extension in php.ini that already works but here in Ubuntu was not enough.

Someone knows how to tell me what to do to resolve it.

asked by anonymous 13.09.2016 / 17:44

2 answers


On Linux systems installing extensions is a bit different. The extensions are not there by default, but we can install with apt-get :

sudo apt install php-pgsql

Depending on your version of Ubuntu / PHP, run the following

sudo apt install php5-pgsql
13.09.2016 / 17:54

In Ubuntu 16.04 (xenial) LTS, the installation command is:

sudo apt-get install php7.0-pgsql
20.09.2016 / 15:19