PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, March 17, 2022

[FIXED] MAMP / PHP.INI: "date.timezone" setting in phpinfo() shows "no value" even though the value is set in php.ini

 March 17, 2022     mamp, php     No comments   

Issue

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.


Solution

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.



Answered By - wizzard
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing