作业帮 > 综合 > 作业

PHP报时区错误 ,不要说修改date.timezone="XXX" 都试过了不管用,centos6.3系统 php 5

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/10 12:33:36
PHP报时区错误 ,不要说修改date.timezone="XXX" 都试过了不管用,centos6.3系统 php 5.4.15 mysql5.5
Warning: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 the timezone 'UTC' for now,but please set date.timezone to select your timezone.in/usr/local/apache2/htdocs/index.phpon line2
修改php.ini中的date.timezone = UTC还确实是正解,修改后要重新启动apache,另外你应该用phpinfo()检查一下你修改php.ini和phpinfo()中指明的当前php.ini是同一个文件.
如果还不行你就在php代码中加上类似
date_default_timezone_set('UTC'); //北京时间用Asia/Shanghai
的一行吧,要在你调用任何时间函数之前.