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


Ran into an issue with Doctrine while trying to force table creation using Symfony’s command line tool..

Command


php app/console doctrine:schema:update --force

Error/Exception


[Exception]

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/New_York' for 'EDT/-4.0/DST' instead

Fix

Im running MAMP. I know this is kind of a hack, but it works. Create a new “php.ini” file in “/private/etc”.

Put the following in the new “php.ini” file


date.timezone = "UTC"

Rerun the command, and all should be good.

Please, if someone has a better fix, feel free to let me know

Advertisements

4 thoughts on “Symfony2 + Doctrine + MAMP : DateTime::__construct(): It is not safe to rely on the system’s timezone settings.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s