如下错误:

PHP 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 in

通过搜索,发现从php5.3 ,当对使用date()等函数时,如果timezone设置不正确,在每一次调用时间函数时,都会产生E_NOTICE 或者 E_WARNING 信息。知道了问题的根源,解决的方法有三种,任选一种即可。

一、在页头使用date_default_timezone_set()设置 date_default_timezone_set(‘PRC’);
二、在页头使用ini_set(‘date.timezone’,'Asia/Shanghai’);
三、修改php.ini。打开php5.ini查找date.timezone 去掉前面的分号修改成为:date.timezone =PRC

注意:上述设置都是针对中国大陆来设置的,同时PRC也可以用Asia/Shanghai,Asia/Chongqing,Asia/Urumqi来代替。

===========================

Warning: strtotime(): It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting, the TZ environment variable 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 ‘America/Chicago’ for ‘CDT/-5.0/DST’ …..

The solution was pretty simple, just be sure to add in /etc/php.ini the time zone where your server is.

In my case “America/New_York”.

So a snip of /etc/php/php.ini is:

; http://php.net/date.timezone date.timezone = America/New_York 

Also be sure to restart Apache once that is done

PHP Warning: date(): It is not safe to rely on the system’s timezone settings相关推荐

  1. 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 ...

  2. 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 ...

  3. 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 ...

  4. 解决php报错Warning: date(): It is not safe to rely on the system's timezone settings

    只需要在php里面加入下面一句代码即可: date_default_timezone_set("PRC"); 这个是设置时区的意思.

  5. 问题解决:Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You.

    在我们使用到时间函数data()时,有时候会弹出下面这种错误: "PHP Warning: date() [function.date]: It is not safe to rely on ...

  6. 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. ...

  7. php echo输出多了 date(): It is not safe to rely on the system‘s timezone settings

    原因 如果使用PHP5.3以上版本时,如果没有正确的配置php.ini就会出现PHP日期函数的错误.以前很多旧的PHP编程教程没有说到这个问题,所以不少读者会觉得困惑,下面笔者为大家讲述解决这个问题的 ...

  8. 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 ...

  9. Warning:It is not safe to rely on the system's timezone settings

    今天在本地运行PHP脚本文件没有问题,但是传到线上测试服务器以后,报了如下错误:<b>Warning</b>: date() [<a href='function.dat ...

最新文章

  1. java随机数 时间_Java 随机数
  2. 【用研】细读7张图片,教你玩转用户调研
  3. jlink烧录软件_使用 MCU BootUtility 工具来烧录I.MXRT
  4. 云巡更系统 云设备巡检 电子云签到
  5. 客户端检测的含义和方法
  6. 1092 最好吃的月饼 (20分)_24行代码AC
  7. SAP Spartacus user和org user form两处不同的checkbox风格
  8. SAP Spartacus Popover Component 显示与否的逻辑判定
  9. matlab meshgrid函数_matlab入门(三)图像可视化
  10. java 学习之List 的 add 与set方法区别
  11. hdu 3829 最大独立集
  12. CAD绘图的规范要点
  13. 如何设置三线表线条的粗细
  14. 如何用ps制作GIF动图
  15. [蓝牙 Mesh Zephyr]-[001]-Mesh beacon
  16. Kaldi声学模型训练
  17. C语言——基本编写规范
  18. Windows10永久关闭Windows Defender
  19. MySQL初级篇——存储过程、存储函数的相关概念及应用举例
  20. [Java]jhsdb查看内存内Java对象

热门文章

  1. SAC 智能版面分析技术(structure Analysis Core )
  2. 基于Session的认证方式_创建工程_准备一个springmvc的工程_Spring Security OAuth2.0认证授权---springcloud工作笔记115
  3. SpringCloud工作笔记031---Idea中JDK为1.8,还提示Diamond types are not supported at this language level
  4. Solr学习笔记001---solr在windows下的安装及配置
  5. 无限网盘,36个T,360网盘无限空间的申请方法www.credream.com
  6. android学习笔记---1.为应用添加新的Activity,中使用Intent(意图),结果码,请求码,得到新打开Activity 关闭后返回的数据,Bundle类的作用
  7. Android学习笔记05---项目的目录结构与安装及启动过程分析
  8. 终端中用命令成功修改linux~Ubuntu PATH环境变量
  9. python当作为条件表达式时_2019知到Python程序设计基础(山东联盟)结课测验答案...
  10. 新概念51单片机C语言教程纠错(1)