Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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.

share|improve this question
    
php.net/pdo_pgsql – Charlotte Dunois Sep 1 '16 at 17:34
    
Where do I get the source files then? – Victor Ferreira Sep 1 '16 at 17:37
    
From php.net php.net/downloads.php#v5.6.25 – Charlotte Dunois Sep 1 '16 at 17:39
    
sudo apt-get install php5-pgsql This will install and enable the pdo_pgsql extension for PHP. – marekful Sep 1 '16 at 17:40
    
@marekful read my edit, please – Victor Ferreira Sep 1 '16 at 17:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.