Some time ago I had installed Apache+MySQL using MacPorts in Mac OS X. It was all OK as long as I used the web browser to navigate thru the web pages, but as I runned PHP via CLI to execute Symfony2 commands I started having problems. It said for example that my time zone was not set, and I knew for sure that I had configured it in the php.ini
file.
$ php app/console doctrine:schema:update --force
Searching the web for a solution I realized that the problem was that I was running the binary php that comes with Mac OS X, and I didn’t have the timezone configured for it. You can see where the php.ini
file is by running this:
$ php -i | grep 'Configuration File' Configuration File (php.ini) Path => /etc Loaded Configuration File => (none)
The first solution i came up with was to use the full path for the MacPorts php binary file:
$ /opt/local/bin/php app/console doctrine:schema:update --force
$ /opt/local/bin/php -i | grep 'Configuration File' Configuration File (php.ini) Path => /opt/local/etc/php5 Loaded Configuration File => /opt/local/etc/php5/php.ini
A better solution consists on adding to the systems path /opt/local/bin
before /usr/bin
. This can be done adding this to ~/.bash_profile
:
PATH=/opt/local/bin:$PATH;export PATH
Then you have to close and open a new terminal or source the newly edited ~/.bash_profile
:
$ source ~/.bash_profile
Ref: Stackoverflow
0 Comments.