关于openwrt上php5时间显示错误

最近更新了下路由器系统至OpenWrt Attitude Adjustment 12.09-rc1,装好lighttpd+php5之后,时间显示出现下面的错误

Fatal error: Uncaught exception ’Exception’ with message ’DateTimeZone::__construct(): Unknown or bad timezone (UTC)’ in /mnt/sda1/phproot/include/lib/function.base.php:625 Stack trace: #0 /mnt/sda1/phproot/include/lib/function.base.php(625): DateTimeZone->__construct(’UTC’) #1 /mnt/sda1/phproot/include/lib/function.base.php(653): getTimeZoneOffset(’Asia/Shanghai’) #2 /mnt/sda1/phproot/include/model/log_model.php(279): emStrtotime(’2013-03-01 23:3…’) #3 /mnt/sda1/phproot/admin/save_log.php(30): Log_Model->postDate(’8’, ’2013-03-01 23:3…’, ’1362151880’) #4 {main} thrown in /mnt/sda1/phproot/include/lib/function.base.php on line 625

查看http://www.wangfan.org/?post=8对这篇文章,发现缺少date函数发生报错问题,安装zoneinfo-asia问题解决。

但是发表日志的时候又出现的下面的错误

 Fatal error: Uncaught exception ’Exception’ with message ’DateTimeZone::__construct(): Unknown or bad timezone (UTC)’ in /mnt/sda1/phproot/include/lib/function.base.php:625 Stack trace: #0 /mnt/sda1/phproot/include/lib/function.base.php(625): DateTimeZone->__construct(’UTC’) #1 /mnt/sda1/phproot/include/lib/function.base.php(653): getTimeZoneOffset(’Asia/Shanghai’) #2 /mnt/sda1/phproot/include/model/log_model.php(279): emStrtotime(’2013-03-01 23:3…’) #3 /mnt/sda1/phproot/admin/save_log.php(30): Log_Model->postDate(’8’, ’2013-03-01 23:3…’, ’1362151880’) #4 {main} thrown in /mnt/sda1/phproot/include/lib/function.base.php on line 625

然后查看下date函数里面有zoneinfo-core这个软件包,安装上之后问题解决。

openwrt新版用php5时间函数的时候需要装对应区域的date函数和zoneinfo-core这两个软件包。国内当然是装zoneinfo-asia亚洲这个。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注