在phpMyadmin显示“Warning: strtotime(): It is not safe to rely on the system\'s timezone settings”的原因

作者:admin     字体:[增加 减小]    类型:原创
如何解决phpMyadmin中显示“Warning: strtotime(): It is not safe to rely on the system\'s timezone settings”错误提示的方法。

以前都没有注意到,今天在phyMyadmin中执行了一个SQL语句,没想到出现了下面一大串的错误提示。

Warning: strtotime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\db_info.inc.php on line 25 Warning: strftime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\common.lib.php on line 1804 Warning: strftime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\common.lib.php on line 1805 Warning: strftime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\common.lib.php on line 1807 Warning: strtotime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\db_info.inc.php on line 29 Warning: strftime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\common.lib.php on line 1804 Warning: strftime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\common.lib.php on line 1805 Warning: strftime(): 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 'UTC' for '8.0/no DST' instead in C:\AppServ\www\phpMyAdmin\libraries\common.lib.php on line 1807

其实认真分析一下,其实错误的原因很简单,是因为没有设置时区的原因,直接说解决的办法,找到下面的文件

/phpMyAdmin/libraries/common.lib.php

在开始的地方加一行代码

date_default_timezone_set('PRC');   //设置时区

如果还不明白,见下图 phpMyadmin在common.lib.php文件中设置时区