A-A+

Warning date() It is not safe to rely on the system’s timezone settin

2015年09月15日 PHP开源系统 评论 4 条 阅读 144 views 次

在本地新安装 ecshop 时出现如下的错误警告:

Warning: date(): 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 /data/wwwroot/includes/lib_time.php on line 28 OK

其中创建配置文件成功,创建数据库成功,安装数据成功,创建管理员帐号失败,看来是卡在创建管理员的地方了,谷歌了一番,原来是本地 php.ini 配置的问题,在php.ini中设置 date.timezone=PRC,OK,再次安装成功,夏日博客另外在谷歌还找到另一种解决方法,就是更改 init.php 文件,找到如下代码:

if (PHP_VERSION >= '5.1' && !empty($timezone)) { date_default_timezone_set($timezone); }

修改为:

(PHP_VERSION >= '5.1') { empty($timezone) date_default_timezone_set("PRC"):date_default_timezone_set($timezone); }

大致的意思就是本地的 php 环境时间不对,只要较正之后基本不会出现这样的问题。

标签:

4 条留言  访客:4 条  博主:0 条

  1. 香港虚拟主机

    博主你网站的百度权重已经达到4了,今天才发现,恭喜恭喜,不知道你看到没

    • smiling

      嗯,有一段时间了。

  2. 微童年

    看不懂还是要支持

  3. 微童年

    虽然看不懂还是过来支持一下

给我留言