在没有配置,尤其是新安装的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. 调用windows的复制文件对话框

    function CopyFileDir(sDirName: String; sToDirName: String): Boolean; var fo: TSHFILEOPSTRUCT; begin ...

  2. java动态代理的原理

    在许多mvc框架中,经常用到注解来实现面向切面(aop)的编程.面向切面编程,可以对业务逻辑中各部分进行分离,提高程序的重用性,降低各逻辑业务部分的耦合度. jdk中利用反射原理使用Proxy类对对象 ...

  3. vue 自定义指令(directive)实例

    一.内置指令 1.v-bind:响应并更新DOM特性:例如:v-bind:href  v-bind:class  v-bind:title  v-bind:bb 2.v-on:用于监听DOM事件: 例 ...

  4. python+appium学习总结

    经过了这个月的学习,今天终于完成了公司APP系统的自动化的脚本的编写. 通过单元测试框架UNITTEST,进行脚本的连跑,本来还想把测试数据统一写到EXCEL表格内,实现脚本与数据的分离. 后来发现增 ...

  5. JSP 取list的长度

    引入:<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> L ...

  6. dubbo超时原理以及解决方案

    dubbo超时原理以及解决方案 本篇主要记录dubbo中关于超时的常见问题,实现原理,解决的问题 超时问题 为了检查对dubbo超时的理解,尝试回答如下几个问题,如果回答不上来或者不确定那么说明此处需 ...

  7. linux基础--目录介绍

    Windows和Linux文件系统区别 在 windows 平台下,打开“计算机”,我们看到的是一个个的驱动器盘符: 每个驱动器都有自己的根目录结构,这样形成了多个树并列的情形,如图所示: 在 Lin ...

  8. oracle查询不显示小数点前的0

    1.问题起源       oracle 数据库字段值为小于1的小数时,使用char类型处理,会丢失小数点前面的0       例如0.35就变成了.35 2.解决办法:用to_char函数格式化数字显 ...

  9. 微信公众号开发笔记-验证token

    开发 话不多说我们直接进入主题 我们先去微信公众号申请一个公众号: 申请完成之后我们找到开发下的基本配置 然后找到进行基本配置,我们需要一个url地址来验证,这里的地址必需要是外网,Token是我们任 ...

  10. JS模拟实现题目(new debounce throwee 等)

    模拟new实现 function newObject() { let obj = new Object(); let Con = [].shift.apply(arguments) obj.__pro ...