Php – MAMP / Symfony: MAMP overrides date.timezone setting from php.ini, Symfony fails

mampPHPsymfony

I'm trying to configure Symfony2 framework in MAMP.

In php.ini I have correctly set date.timezone, however, it appears that MAMP somehow overrides the setting and uses system time instead.

As a result, Symphony's config.php page sends this warning:

Warning: date_default_timezone_get()
[function.date-default-timezone-get]: 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 'EST/-5.0/no DST' instead in
/Applications/MAMP/htdocs/Symfony/app/SymfonyRequirements.php on line
434

Symfony fails to show start page until this has been fixed. What would be the solution?

Thank you!

Best Answer

Check if there are two php.ini files in your system. You may be adding the date.timezone line in one of them but MAMP is using the other.

If that doesn´t work for you try adding the following line at the beginning of your web/app.php and web/app_dev.php files, (as the error message suggests):

date_default_timezone_get('Europe/London');

Hope it helps.

Related Topic