phpinfo(): It is not safe to rely on the system's timezone settings
PHP调试的时候出现了警告:
问题:
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 /mnt/web/index.php on line 2 解决方法1:(最好的方法)在php.ini里加上找到date.timezone项,设置date.timezone = "Asia/Shanghai",重启环境就ok了。
====下面是网上摘抄
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');
错误代码:
Warning: date(): 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
Warning: strtotime(): 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
Warning: date_default_timezone_get(): 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>/home/ftp/n/nimaboke/include/lib/function.base.php
phpinfo(): It is not safe to rely on the system's timezone settings的更多相关文章
- PHP Warning: phpinfo(): It is not safe to rely on the system's timezone setting
错误描述: PHP Warning: phpinfo(): It is not safe to rely on the system's timezone settings. You are *re ...
- Warning: strftime(): It is not safe to rely on the system's timezone settings.
当运行程序时,会出现如下警告: Warning: strftime(): It is not safe to rely on the system's timezone settings. You a ...
- 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. ...
- mac下apache配置,解决It is not safe to rely on the system's timezone settings.
之前一直转windows平台下做php,很少遇到问题.现在有了macbook,还在慢慢的熟悉中,搭建php开发环境,熟悉mac系统文档组织还有命令,颇费功夫. 今天我在mac下做一个php的练习,用到 ...
- 解决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 ...
- 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 ...
- 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: strtotime(): It is not safe to rely on the system's timezone settings
warning: strtotime(): It is not safe to rely on the system's timezone settings warning: strtotime(): ...
- date(): It is not safe to rely on the system’s timezone settings.
在执行php脚本时出现的错误: date(): It is not safe to rely on the system’s timezone settings.You are *required* ...
随机推荐
- C语言运算符的优先级与结合性
结合性:左结合是从左到右依次执行,右结合是从右到左依次执行. 优先级 运算符 名称或作用 运算类型 结合方向 特点 1 () [] -> . 小括号运算符 下标运算符 指向结构成员运算符 结构成 ...
- 四种webAPP横向滑动模式图解—H5页面开发
一.容器整体滑动(DEMO只演示A-B-C-B,下同) 模拟动画效果见下图(上),滑动分解见下图(下): DEMO地址:http://nirvana.sinaapp.com/demo_slider/s ...
- 0004 继承django系统用户表
1 创建基础模型 在本项目中,所有表都有两个自动产生的完全相同的字段,即创建时间和更新时间,因此,可以创建一个基础模型,让所有的表都来继承这个模型. 找到工程目录下的PublicMethod目录,创建 ...
- 【Python】文本进度条
1.0代码: import time#引入time库 scale=10#文本进度条宽度 print("------执行开始------") for i in range(scale ...
- Action路径问题
上网搜了一下,先给个解决方案,贴个图保存,后面再专门写一写总结.
- Elasticsearch集群知识笔记
Elasticsearch集群知识笔记 Elasticsearch内部提供了一个rest接口用于查看集群内部的健康状况: curl -XGET http://localhost:9200/_clust ...
- ServletContext总结(转)
今天我们学习的是ServletContext的应用. WEB容器在启动时,它会为每个WEB应用程序都创建一个对应的ServletContext对象,它代表当前web应用. ServletConfig对 ...
- 1.5 面试问题整理:cl
1.自我介绍2.介绍测试的项目> 期望答案:让你介绍项目,目的是想知道你参与过该项目后,对该项目的认识程度和认识层次,从而判断你在项目中到底起多大作用. 即:测试的流程.用例设计的方法.在项目中 ...
- 10.4.3反向迭代器Reverse_iterator笔记
反向迭代器就是在容器中从尾元素向首元素反向移动的迭代器.对于反向携带器,递增(以及递减)操作的含义会颠倒过来.递增一个反向迭代器(++it)会移动到前一个元素:递减一个迭代器(--it)会移动到下一个 ...
- Codeforces Round #620 (Div. 2)E(LCA求树上两点最短距离)
LCA求树上两点最短距离,如果a,b之间距离小于等于k并且奇偶性与k相同显然YES:或者可以从a先走到x再走到y再走到b,并且a,x之间距离加b,y之间距离+1小于等于k并且奇偶性与k相同也输出YES ...