解决php的“It is not safe to rely on the system’s timezone settings”问题
PHP调试的时候出现了警告: It is not safe to rely on the system解决方法,其实就是时区设置不正确造成的,本文提供了3种方法来解决这个问题。
实际上,从PHP 5.1.0开始当对使用date()等函数时,如果timezone设置不正确,在每一次调用时间函数时,都会产生E_NOTICE 或者 E_WARNING 信息,而又在php中,date.timezone这个选项,默认情况下是关闭的,无论用什么php命令都是格林威治标准时间,但是PHP5.3中如果没有设置部分时间类函数也会强行抛出了这个错误的。
PS:现在由于大部分人使用VPS/云主机,需要自己配置的环境的就更加会容易出现这个情况。
建议:不熟悉PHP环境还是用比较成熟的一键安装包吧。
方法1:
(最好的方法)在php.ini里加上找到date.timezone项,设置date.timezone = "Asia/Shanghai",重启环境就ok了。
方法2:
在需要用到这些时间函数的时候,在页面添加date_default_timezone_set("PRC");
方法3:
在页头加上设置时区ini_set('date.timezone','Asia/Shanghai');
转载于:https://www.cnblogs.com/ryanzheng/p/8285540.html
解决php的“It is not safe to rely on the system’s timezone settings”问题相关推荐
- 解决php的It is not safe to rely on the system’s timezone settings的问题
访问网站提示: date(): It is not safe to rely on the system's timezone settings. You are *required* to use ...
- php Warning: phpinfo(): It is not safe to rely on the system's timezone settings.解决方法
安装php后,使用phpinfo();查看信息,有Warning: phpinfo(): It is not safe to rely on the system's timezone setting ...
- It is not safe to rely on the system's timezone settings
在写php程序中有时会出现这样的警告: PHP Warning: date(): It is not safe to rely on the system's timezone settings. Y ...
- PHP Warning: date(): It is not safe to rely on the system's timezone settings
在用PHP5.3以上的PHP版本时,只要是涉及时间的会报一个 "PHP Warning: date() [function.date]: It is not safe to rely on ...
- php : Warning: strftime(): It is not safe to rely on the system's timezone settings.
使用 Smarty 的时候出现这种警告: Warning: strftime(): It is not safe to rely on the system's timezone settings. ...
- PHP Warning: date(): It is not safe to rely on the system’s timezone settings
如下错误: PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *requir ...
- Warning: date() :It is not safe to rely on the system's timezone settings
在执行php文件时会出现下面的错误: PHP Warning: date(): It is not safe to rely on the system's timezone settings. Y ...
- php echo输出多了 date(): It is not safe to rely on the system‘s timezone settings
原因 如果使用PHP5.3以上版本时,如果没有正确的配置php.ini就会出现PHP日期函数的错误.以前很多旧的PHP编程教程没有说到这个问题,所以不少读者会觉得困惑,下面笔者为大家讲述解决这个问题的 ...
- PHP Warning: date(): It is not safe to rely on the system's timezone settings.
OSSEC安装结束后运行,运行以下命令却抛错 cat /opt/ossec/logs/alerts/alerts.log 具体抛错内容: ** Alert 1468897672.2164786: ma ...
最新文章
- shell脚本初级教学(从基本脚本开始学起)
- 【自动驾驶】8. MDC通信架构 + DDS + SOME/IP
- 使用Spring Boot构建RESTFul服务
- 分组分页连接查询子查询9202-0422
- cf706C(dp)
- vscode快速下载方法
- java字符串时间去掉秒_Java:当秒和毫秒均为0时,DateTimeFormatter无法解析时间字符串吗?...
- STL算法之 copy、copy_backward、copy_n
- CPE/CPA/CPL/CPC/CPM/CPO/CPS/CPV/CPT/CPP广告
- Android device monitor
- 《事情正在起变化》《这是为什么》?
- 浏览器解析jsx_React 初窥:JSX 详解
- 删除数据后如何及时释放存储空间
- 药店管理系统源码 药店管理信息系统源码带文档
- 捕鱼来了2017系列游戏
- nubia Z5 mini 小牛 黑砖qhsusb dload修复
- 百合数c语言360问答,百合数量的含义?
- 关于cfg80211
- 用计算机谈好汉歌,好汉歌计算机谱 | 手游网游页游攻略大全
- 英语的动词分类_13
热门文章
- Android用mediaPlayer.prepare()报错
- aws cli 上传文件到s3命令_使用 AWS CLI 分段上传到 Amazon S3
- 上半年股价超跌反弹75%,趣店能否重回百亿市值?
- gpu训练cnn人脸识别准确率_opencv+mtcnn+facenet+python+tensorflow 实现实时人脸识别
- 机器人轨迹规划——多项式轨迹实战
- hypermesh 根据坐标施加载荷- Field 载荷映射,以温度场载荷为例
- 29.7 MySQL灾难恢复
- Android 给地震监视器添加Notification
- Windows电脑关闭触摸键盘的方法
- 矩阵理论(二)特征值分解和SVD分解