Search code examples
mysqlsymfony1doctrineterminalcommand-line-interface

how to edit php.ini in CLI


I am working on a symfony project using MAMP.

I am trying to load data into sql from Terminal with this script:

php symfony doctrine:insert-sql

I am getting this error:

Couldn't locate driver named mysql

The forums have explained you should have pdo_sql enabled.

This is enabled in MAMP/conf/php5.2/php.ini and MAMP/conf/php5.3/php.ini

The researched documentation states that the php.ini file in the CLI is different from the php.ini file located in apache.

How can I locate and edit the php.ini file in the CLI, which is obviously different from the ones located in the MAMP directory?


Solution

  • run this on the command line:

    php -info | grep Confi
    

    it should give you an output like

    Configuration File (php.ini) Path => /etc/php5/cli
    Loaded Configuration File => (none)
    

    But you don't have to edit it. You can just simply use the one that is used by MAMP:

    php -c /path/to/your/php.ini symfony doctrine:insert-sql