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!
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.
I am still working on figuring out why and how MAMP overrides the php.ini date.timezone settings, however, I have found the quick fix solution within Symfony php files, which solved the problem, at least for now.
I added the following bit of code:
date_default_timezone_set ('America/New_York');
-- at the top of Symfony's config.php and app_dev.php files, immediately after the opening php tag, at the very top of the script. This removed the warning message and got Symfony working on MAMP.
I foresee having to add the same code to some other php files inside Symfony as I keep hacking at it, which shouldn't be a problem. Or I may figure out how to override MAMP's overriding.
Still, this is a workable solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With