centos下在php.ini设置时区

时间:2023-12-20 19:14:32

错误:

PHP Warning: Unknown: 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 Unknown on line 0

解决方法:

find / -name php.ini  命令找到php.ini配置文件

找到date.timezone选项改为:date.timezone =PRC

service httpd restart 重启服务

(单页面的话可以设置date_default_timezone_set('PRC')