PHP Warning: date(): It is not safe to rely on the system’s timezone settings
如下错误:
通过搜索,发现从php5.3 ,当对使用date()等函数时,如果timezone设置不正确,在每一次调用时间函数时,都会产生E_NOTICE 或者 E_WARNING 信息。知道了问题的根源,解决的方法有三种,任选一种即可。
注意:上述设置都是针对中国大陆来设置的,同时PRC也可以用Asia/Shanghai,Asia/Chongqing,Asia/Urumqi来代替。
===========================
Warning: strtotime(): It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting, the TZ environment variable 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/Chicago’ for ‘CDT/-5.0/DST’ …..
The solution was pretty simple, just be sure to add in /etc/php.ini
the time zone where your server is.
In my case “America/New_York”.
So a snip of /etc/php/php.ini
is:
; http://php.net/date.timezone date.timezone = America/New_York
Also be sure to restart Apache once that is done