在没有配置,尤其是新安装的PHP中使用date函数时,会报这个错误:

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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/apache/htdocs/testsql.php on line 2
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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/apache/htdocs/testsql.php on line 3

这是因为,使用5.3以上版本时,没有正确的配置php.ini

解决方案如下:

vim /usr/local/php/etc/php.ini

找到timezone,去掉注释,并设置时区,在等于号后面加上Asia/Shanghai

出现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 ...报错

    错误截图 Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* t ...

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

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

  5. 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(): ...

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

  7. PHP Warning: strtotime(): It is not safe to rely on the system's timezone settings.

    有三种解决办法: 1. php文件中设置时区 <?php date_default_timezone_set('Asia/Shanghai'); echo strtotime('2012-9-3 ...

  8. yii2定时任务不执行,报错PHP date调用警告:It is not safe to rely on the system's timezone settings

    It is not safe to rely on the system's timezone settings 在写php程序中有时会出现这样的警告:PHP Warning: date(): It ...

  9. 解决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. paper 145:caffe-深度学习框架的搭建

    参考来源于:http://www.cnblogs.com/goodluckcwl/p/5686094.html  (部分内容做了修改) Caffe是一个深度学习框架,本文讲阐述如何在linux下安装G ...

  2. 探索Redis设计与实现14:Redis事务浅析与ACID特性介绍

    本文转自互联网 本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial ...

  3. 建站手册-浏览器信息:Internet Explorer 浏览器

    ylbtech-建站手册-浏览器信息:Internet Explorer 浏览器 1.返回顶部 1. http://www.w3school.com.cn/browsers/browsers_inte ...

  4. LInux终端中Ctrl+S卡死

    因为初学Linux,在vim中写东西是总是喜欢按Ctrl+s来保存内容导致终端突然卡主,然后上网查资料发现了Ctrl+s 暂停屏幕输出[锁住终端]而对应的按键是Ctrl+q 恢复屏幕输出[解锁终端]

  5. 8. Jmeter导入jar包

    我们都知道Jmeter是Java编写的,所以有很多时候需要用到Java方面的知识.比如Jmeter前置处理器,就用到了很多Java知识.那么本章我们先介绍如何使用Jmeter导人jar包. 工具准备 ...

  6. 【单例模式】懒汉式的线程安全问题 volatile的作用

    原文链接:https://blog.csdn.net/Activity_Time/article/details/96496579 ****** 1. 懒汉式的Java实现 public class ...

  7. 搭建RAID5(5块硬盘)过程并模拟一块磁盘损坏情况

    首先:在配置RAID5之前我们先来了解一下它.RAID5,RAID是指独立磁盘冗余阵列,是把相同的数据存储在多个硬盘的不同地方的方法.通过把数据放在多个硬盘上,输入输出操作能以平衡的方式交叠,改良性能 ...

  8. java 重新学习 (四)

    一.内部类成员可以直接访问外部类的私有数据,因为内部类被当成其外部类成员,同一个类中的成员之间可以相互访问.但外部类不能访问内部类的实现细节,例如内部类的成员变量.匿名内部类适合用于创建仅需要一次使用 ...

  9. python *arg和**kwargs的区别

    转载自:https://www.cnblogs.com/yunguoxiaoqiao/p/7626992.html 一.*args的使用方法 *args 用来将参数打包成tuple给函数体调用 举个栗 ...

  10. QT的三种开发方式

    最近在学习QT GUI,单纯使用C++硬编码的方式,直接是采用QWidget部件来做,而不是采用QT Designer做UI界面,也不是采用QML+Javascript.单纯使用C++硬编码的方式,缺 ...