首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法在php.ini文件中设置date.timezone

无法在php.ini文件中设置date.timezone
EN

Stack Overflow用户
提问于 2013-12-08 17:16:20
回答 8查看 86.6K关注 0票数 22

我使用php5.5,每当我在PHP中使用date函数时都会得到这个错误:

 Warning: phpinfo(): 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/info.php on line 1

加载的配置文件如下:

/etc/php5/apache2/php.ini 

因此,我将date.timezone设置更改为:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Jakarta

; http://php.net/date.default-latitude
;date.default_latitude = 31.7667

; http://php.net/date.default-longitude
;date.default_longitude = 35.2333

; http://php.net/date.sunrise-zenith
;date.sunrise_zenith = 90.583333

; http://php.net/date.sunset-zenith
;date.sunset_zenith = 90.583333

然后我重新启动服务器:

sudo /etc/init.d/apache2 restart

但仍然收到此错误,我尝试检查附加ini文件位置中的.ini文件,但它们都没有覆盖date.timezone设置

我已经检查了php.ini文件权限,但是仍然不能工作,请指导我解决这个问题,谢谢..

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20451719

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档