我从来没有见过phpinfo()之前给错误。 是什么赋予了? 我应该在php.ini中寻找什么?
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 'EDT/-4.0/DST' instead in /Users/{me}/Sites/localmirror/htdocs/tests/phpinfo.php on line 3
违规文件:
<?php phpinfo(); ?>
编辑:啊,理解一些,警告意味着我需要在php.ini中设置“date.timezone”。 我以为他们正在谈论“你”的PHP程序员,而他们正在谈论“你”的系统pipe理员。
你仍然得到这样的东西同样的错误?
<?php if(date_default_timezone_set('Europe/Stockholm') == 0) { print "<!-- Error uknown timezone using UTC as default -->\n"; date_default_timezone_set('UTC'); } phpinfo(); ?>
答案是在我的php.ini文件中date.timezone = ...行并添加适当的时区(在我的情况下是“US / Eastern”)。 我想我是错过了显而易见的。
您可能会认为这是一个麻烦,但从我的angular度来看,这是应该要求的,因为我在PHP应用程序的pipe理时区上依赖很多插入date到MySQL数据库时,以及能够允许更改时间从用户的angular度来看,作为一个服务器可能会被放在纽约,而我的客户希望他的所有date按照洛杉矶时间保存。
这只是我的承担,如果你不想遇到这样的问题,你可以随时切换到5.2.xx,或者开始在你的php.ini或你的应用程序中设置它。
这是另一个PHP的灾难,的确,如何愚蠢的不依靠系统范围的设置? PHP现在正在走向一个悲惨的方向。