Search code examples
phppostgresqlsymfonypdomamp

PDO Exception could not find driver


I know this question have been asked a thousand of times, but I can't find a solution. I'm running Symfony 2 with a PostgreSql database (php running in MAMP, and PG DB on an another port and install).

I was running well (could have install the DB using the app/console create cmd) however now I can't use it anymore for updating the schema. Got the error :

PDO Exception, could not find driver error

I tried everything:

  • Php.ini verification : OK
  • using the same in the CLI and phpInfo();
  • PDO verification in phpInfo : drivers enabled for pgSQL mySQL etc...
  • Restart Mamp + OSX apache server : OK

Solution

  • Found a solution, I just made an alias in my .bash_profile to the php used by the server to be sure that the CLI will use the good one.

    Alias PHP -> Mamp CLI

    alias phpmamp='/Applications/MAMP/bin/php/php5.4.4/bin/php'

    Now it works.