解决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 ...
最新文章
- 认识Linux的磁盘配额(转载)
- angularjs源码笔记(3)--injector
- Oracle的存储过程和存储函数
- 论文 参考文献的格式说明
- nginx curl linux,linux nginx 下通过curl url方式,符以后的参数无效
- 终于,J 神还是加入了 Google!
- maven 里的 repositories里空的_IntelliJ IDEA 结合 maven通过profile实现多环境
- [黑苹果]简单修改FB实现显存增加至2048MB修复某些花屏
- 崮德好文连载 - 活该你是工程师(自序)
- 基于MATLAB的线性规划
- 突发,拼多多发生重大变更!
- 计算机显示 亮度怎么调整,电脑屏幕亮度调整一直显示怎么办
- 这一次,彻底拿下操作系统!!!
- 编程基础——鱼龙混杂来两波
- 阿里云轻量服务器怎么设置密码?
- html设计应用程序,软件工程师-20个HTML5应用程序设计示例(10页)-原创力文档
- 4.再模仿一个算术题
- funcode游戏实训,java及C/C++,网上整理
- 2021跨保计算机实录(浙大软院、中山计院)
- Android:i2c调试工具 i2c-tools的使用,在Android external目录下新增一个可执行应用及编译,i2cdetect -y 1或i2cdetect -r -y 1。