Symfony2 Exception – DateTime::__construct(): It is not safe to rely on the system’s timezone settings.

Dando os primeiros passos com o Symfony2, acabei batendo de frente com um erro que provavelmente veio da configuração do MAMP.

DateTime::__construct(): It is not safe to rely on the system’s timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Sao_Paulo’ for ‘BRT/-3.0/no DST’ instead

O php que eu estou chamando fica no /usr/bin/php.

Para solucionar o problema eu passei o arquivo de configuração pela linha de comando.

$ php -c /Applications/MAMP/bin/php/php5.3.6/conf/ app/console
Symfony version 2.0.0 – app/dev/debug
Usage:
  [options] command [arguments]
(...)

Criei um alias para melhorar mais ainda:

$ alias sf2=“php -c /Applications/MAMP/bin/php/php5.3.6/conf/”
$ sf2 app/console
Symfony version 2.0.0 – app/dev/debug
Usage:
  [options] command [arguments]
(...)