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的更多相关文章

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

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

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

  4. mac下apache配置,解决It is not safe to rely on the system's timezone settings.

    之前一直转windows平台下做php,很少遇到问题.现在有了macbook,还在慢慢的熟悉中,搭建php开发环境,熟悉mac系统文档组织还有命令,颇费功夫. 今天我在mac下做一个php的练习,用到 ...

  5. 解决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 ...

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

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

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

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

随机推荐

  1. 2.restEasy中@PathParam和@QueryParam的区别

    例如代码: @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public T query(@PathParam( ...

  2. C语言中各数据类型(eg.int和float的区别)

  3. Linux - Shell - 字符串截取

    概述 简述 字符串 截取 背景 之前因为要给文件 批量重命名, 做过字符串截取 当时做好了, 也说了要写点东西 结果忘了 现在又要尝试批量 重命名 才发现之前的东西已经忘了好多 要是当时把博客写下来, ...

  4. php多版本使用composer

    适用多版本的方法 1:下载composer.phar,官网有直接下载的链接,https://getcomposer.org/download/ 2:composer.phar 复制到项目根目录 3:p ...

  5. 实现排行榜神器——redis zset

    需求:假如现在需要搞个 “运动消耗卡路里排行榜”,例似微信步数排名,显示排名前20人的信息和消耗的卡里路,怎样实现排序? 一般思路:存储信息,然后数据库查询,排序?(假如有几十万人参与排名,这样查my ...

  6. 10.4.3反向迭代器Reverse_iterator笔记

    反向迭代器就是在容器中从尾元素向首元素反向移动的迭代器.对于反向携带器,递增(以及递减)操作的含义会颠倒过来.递增一个反向迭代器(++it)会移动到前一个元素:递减一个迭代器(--it)会移动到下一个 ...

  7. 转载:EQ--biquad filter

    http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt https://arachnoid.com/BiQuadDesigner/index.html ...

  8. 通过scrapy,从模拟登录开始爬取知乎的问答数据

    这篇文章将讲解如何爬取知乎上面的问答数据. 首先,我们需要知道,想要爬取知乎上面的数据,第一步肯定是登录,所以我们先介绍一下模拟登录: 先说一下我的思路: 1.首先我们需要控制登录的入口,重写star ...

  9. JS-ES6语法运用

    import导入模块,js的模块化开发 浏览器使用ES6模块化语法(使用module时js代码自动运行严格模式): <script type="module" src=&qu ...

  10. python正则--re模块常用方法

    前面几篇关于正则匹配的文章我用的方法都只有一个re.search 但其实正则re模块提供很多非常好用的方法,我们先来看看re模块都有那些属性方法呢 前面的一堆带_或者大写的就不关注了,主要关注最后面的 ...