I've spent some hours trying to change the connection driver of my Laravel app from MySQL to Postgres. I'm working with Laravel 5.2 on a Ubuntu 14 (and PHP 5.5.9).
I had Postgres installed in this computer before starting it all. The version I got is 9.3.12.
The problem I'm having is that when my App uses the database it throws an error:
PDOException in Connector.php line 55:
could not find driver
In PHPInfo it says
PDO Drivers: mysql
And running php -m
I don't see anything related to Postgres.
So it seems it's not installed in my computer, but everytime I try to install these modules I get errors, usually related to dependencies.
What is the proper way to get Postgres installed for PHP5?
@edit
With the suggested command sudo apt-get install php5-pgsql
I get a message (in my language) that is similar to the following:
The following packages have not found dependencies
php5-pgsql : Depends: php5-common (= 5.5.9+dfsg-1ubuntu4) but 5.5.9+dfsg-1ubuntu4.14 is installed
E: Impossible to fix problems, you kept (hold) broken packages.
sudo apt-get install php5-pgsql
This will install and enable thepdo_pgsql
extension for PHP. – marekful Sep 1 '16 at 17:40