Greetings to StackOverflow gurus!
Here's the issue I'm struggling with.
I run phpinfo() in MAMP, and the resulting table shows "no value" in both columns of the date.timezone row.
Additionally, the page displays the following:
Warning: phpinfo() [function.phpinfo]: 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/bin/mamp/phpinfo.php
In thr php.ini file, however, the setting is as follows:
date.timezone = America/New_York
I foresee the recommendation to check that the path to php.ini is correct - I've already done that, and the path is indeed correct: /Applications/MAMP/conf/php5.3/php.ini - that IS the file that has the value set.
How can I remedy the issue? What am I missing?
Would be grateful for help from a knowledgeable person.
I know I might be a little late in answering this but I see on a few sites that you are asking about setting the correct timezone in MAMP.
It should be noted that there are two locations for a php.ini file for the version of php you are using. MAMP could be loading it from a different path then the one you are editing.
For example, lets say we are using php 5.3. Here are two locations of a php.ini file that could confuse someone on which one to edit.
/Applications/MAMP/bin/php/php5.3/conf/php.ini
You seem to be editing it at this location below:
/Applications/MAMP/conf/php5.3/php.ini
Editing the timezone in the second path did not work for me but editing the one in the first one did. It could be that you are editing the wrong file even though it looks the same. I have tested this on my version. Running <?php phpinfo(); ?>
in a php file and checking the path of the php.ini file will always show the correct path.
Also just to point out, using double quotes around the value of date.timezone will work. For example in my php.ini file the following works.
date.timezone = "America/Vancouver"
Also the default value was encapsulated in double quotes as well.
I was also using MAMP version 2.1.1 when testing this out.
If the timezone is set correctly in the pertinent php.ini file and you are still getting this message, you can try setting your TZ environment variable. Edit your .profile to add the following line (sub in your own timezone string):
export TZ="America/New_York"
Not sure why (a) MAMP overrides your php.ini setting, (b) PHP doesn't throw a notice/warning when using the TZ env variable even though it says it will, but this solution worked for me using MAMP 2.0.5 with PHP 5.3.6.
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