It is not safe to rely on the system’s timezone settings
在执行phpinfo();出现
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 ‘Asia/Chongqing’ for ‘CST/8.0/no DST’ instead in /usr/local/apache/htdocs/index.php on line 2
cat /etc/php.ini
在[date]里date.timezone并没有启用,造成了PHP的时区出错,
有两种解决方法:
一、在PHP文件里添加date_default_timezone_set (‘Asia/Shanghai’);
二、修改 php.ini文件,
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = ‘Asia/Shanghai’
保存,重启apache即可。