Warning:It is not safe to rely on the system's timezone settings
今天在本地运行PHP脚本文件没有问题,但是传到线上测试服务器以后,报了如下错误:<b>Warning</b>: date() [<a href='function.date'>function.date</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 'Asia/Chongqing' for 'CST/8.0/no DST' instead in <b>
线上测试服务器的环境是同事新配置的,看了一眼错误,知道可能是php.ini配置文件关于时区设置的问题
因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入,格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决:
1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,date_default_timezone_set("PRC");。
2、在php.ini中设置 date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。
3、ini_set('date.timezone','Asia/Shanghai');
XXX可以任意正确的值。对于我们国内来说:可以为以下值:Asia/Chongqing ,Asia/Shanghai ,Asia/Urumqi (依次为重庆,上海,乌鲁木齐)港台地区可用:Asia/Macao ,Asia/Hong_Kong ,Asia/Taipei (依次为澳门,香港,台北),还有新加坡:Asia/Singapore,当然PRC也行
转载于:https://www.cnblogs.com/wangjunzi/p/3240802.html
Warning:It is not safe to rely on the system's timezone settings相关推荐
- 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 : 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 ...
- 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 ...
- 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 ...
- Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use
运行php文件报错如下: Warning: date(): It is not safe to rely on the system's timezone settings. You are *req ...
- 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: date(): It is not safe to rely on the system's timezone settings
只需要在php里面加入下面一句代码即可: date_default_timezone_set("PRC"); 这个是设置时区的意思.
- 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 ...
最新文章
- 【转】面向GC的Java编程
- 【推荐】查找一代用户出口Userexit
- F4IF_INT_TABLE_VALUE_REQUEST如何返回多于一个列
- 【数据结构与算法】之深入解析“最优运动员比拼回合”的求解思路与算法示例
- 多核处理器_英特尔十代酷睿i5-10400大战R5 3600,到底谁是千元处理器一霸?
- Python的解释器和字节码
- 软件工程 speedsnail 第二次冲刺1次
- 如何在windows下把硬盘格式化成EXT3格式?
- 【Scratch编程案例教学】scratch消灭砖块 scratch编程案例教学 少儿编程教案
- 屁孩君儿子讲解 2022 【例4.7】最小n值
- Bugzilla的维护与管理
- oracle超级管理员忘记_Oracle 管理员账号密码忘记的快速解决方法
- Unity3d坦克大战联网
- 历史上的三次房地产大泡沫
- 计算机网络习题篇(一)
- IPv6连接类型Native Static、Native DHCPv6、Tunnel 6in4、Tunnel 6to4、Tunnel 6rd的区别
- 游戏计算机性能要求吗,玩电脑大型游戏对于配置有什么要求
- oracle导出报错04063,导出报错:ORA-04063:packagebody“DMSYS.DBMS_DM_MODEL_EXP”hase
- delphi源码转换为C++ Builder源码
- [原创]Fashion汽车定位器拆解
热门文章
- 校园跑腿现状如何?什么因素影响校园跑腿的发展?
- java模拟登录获取Cookie
- lookup无序查找_使用LOOKUP函数实现无序查询
- Matlab中legend的位置
- 【论文】时空预测模型Spatio-Temporal Graph Convolutional Networks
- 随着计算机科学技术和互联网,(题文)下列各句中加点成语的使用,全都正确的一项是、①随着计算机科学技术和互联网技术的快速......
- 合成大西瓜CocosCreator开发源码(可跨平台构建:小程序、android...)
- ftp rush 可以连linux吗,文件FTP传送工具FTP Rush实用技巧
- 软考-信息管理——学习笔记_证
- 鸿蒙系统可以几年不卡顿,鸿蒙系统会不会越用越卡?鸿蒙系统会影响王者荣耀吗?...