How to install the PDO_PGSQL driver in Ubuntu?

Asked

Viewed 13,586 times

8

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

I’ve already enabled the extension on php.ini but it doesn’t work.

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

Can anyone tell me what I should do to fix.

  • Informing the version of Ubuntu can help

  • I’m sorry, the version is 16.04 LTS

  • sudo systemctl Restart apache2

2 answers

13


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

sudo apt install php-pgsql

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

sudo apt install php5-pgsql
  • Thank you very much. It worked perfectly.

2

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

sudo apt-get install php7.0-pgsql

Browser other questions tagged

You are not signed in. Login or sign up in order to post.