date(): It is not safe to rely on the system's timezone settings

部署MetInfo企业网站管理系统(php开源项目)时报此警告。

运行环境: Apache服务器 + MySQL5.5 + PHP5.4.5

函数  string date ( string$format [, int$timestamp ] );  参考文档位置 date函数说明

 

it's a warning in PHP 5.4, looks like it could be a security issue:

date(): It is not safe to rely on the system's timezone settings. You arerequired 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.


例如,当调用date('Y');函数时会报此警告

解决方法1 :  在调用此方法之前,调用date_default_timezone_set("UTC");

解决方法2:   在php.ini中查找date.timezone 去掉前面的分号修改



posted @ 2012-11-16 19:40  沙漏哟  阅读(201)  评论(0编辑  收藏  举报