It is not safe to rely on the system's timezone settings. 这个错误是由于服务器没有设置默认时区引起的

By lincanbin at 2014-11-25 • 0人收藏 • 2222人看过
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() 
[<a href='datetime.--construct'>datetime.--construct</a>]: 
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 /BUDST' instead' in D:\home\ftp\w\weihelp\web\forum\includes\PDO.Log.class.php:17 Stack trace: #0 D:\home\ftp\w\weihelp\web\forum\includes\PDO.Log.class.php(17): DateTime->__construct() #1 D:\home\ftp\w\weihelp\web\forum\includes\PDO.class.php(335): Log->write('SQLSTATE[28000]...') #2 D:\home\ftp\w\weihelp\web\forum\includes\PDO.class.php(107): DB->ExceptionLog('SQLSTATE[28000]...') #3 D:\home\ftp\w\weihelp\web\forum\includes\PDO.class.php(71): DB->Connect() #4 D:\home\ftp\w\weihelp\web\forum\install\index.php(25): DB->__construct('localhost', 'weihelp', 'weihelp', 'C8889BED261 in D:\home\ftp\w\weihelp\web\forum\includes\PDO.Log.class.php on line 17

写入日志时需要DateTime这个类的支持,这个类记录的并非unix时间戳(UTC时间),而是根据时区选择的本地时间,没有默认的时区设置就会抛出这样的一个错误。

解决方法就是在install/index.php里的开头加上

date_default_timezone_set("PRC");

一般的php.ini里都会有默认的时区设置的。

登录后方可回帖

登 录
信息栏

Carbon Forum是一个基于话题的高性能轻型PHP论坛

下载地址:Carbon Forum v5.9.0
QQ群:12607708(QQ我不常上)

donate

手机支付宝扫描上方二维码可向本项目捐款

粤公网安备 44030602003677号
粤ICP备17135490号

Loading...