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. 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 'UTC' for '8.0/no DST' instead in ...
这是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,
我们可以按照下面的方法解决:
1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即<?phpdate_default_timezone_set("PRC");?>就可以了。
OR
2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。 
 
重启httpd就好了
 
基本的操作方法:
本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况
apahce启动命令:
推荐/usr/local/apache2/bin/apachectl start apaceh启动
apache停止命令
/usr/local/apache2/bin/apachectl stop 停止
apache重新启动命令:
/usr/local/apache2/bin/apachectl restart 重启
要在重启 Apache 服务器时不中断当前的连接,则应运行:
/usr/local/sbin/apachectl graceful
如果apache安装成为linux的服务的话,可以用以下命令操作:
service httpd start 启动
service httpd restart 重新启动
service httpd stop 停止服务 Linux系统为Ubuntu
一、Start Apache 2 Server /启动apache服务
# /etc/init.d/apache2 start
or
$ sudo /etc/init.d/apache2 start
二、 Restart Apache 2 Server /重启apache服务
# /etc/init.d/apache2 restart
or
$ sudo /etc/init.d/apache2 restart
三、Stop Apache 2 Server /停止apache服务
# /etc/init.d/apache2 stop
or
$ sudo /etc/init.d/apache2 stop

  

yii2定时任务不执行,报错PHP date调用警告:It is not safe to rely on the system's timezone settings的更多相关文章

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

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

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

  4. 出现Warning: date(): It is not safe to rely on the system's timezone settings的解决办法

    在没有配置,尤其是新安装的PHP中使用date函数时,会报这个错误: Warning: date(): It is not safe to rely on the system's timezone ...

  5. PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone

    在用PHP5.3以上的PHP版本时,只要是涉及时间的会报一个 Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the ...

  6. oracle创建包后执行报错:object omgmig.test_package is invalid.

    今天学习了一下oracle的包的写法,然后碰到这么个问题.包声明和包主体都正确,但是就是执行报错:object omgmig.test_package is invalid. 这是会报错的sql,看起 ...

  7. salt执行报错一例

    执行报错: 查看服务端日志: 认证有问题 重新认证吧!!! minion端: [root@super66 ~]# cd /etc/salt/[root@super66 salt]# lsminion ...

  8. Ubuntu下sh *.sh使用==操作符执行报错

    ----<鸟哥的Linux私房菜--基础篇>学习笔记 ubuntu默认的sh是连接到dash,而我们写shell脚本时使用的时bash.bash和dash在一些方面是不兼容的.因此执行同一 ...

  9. windows中修改catalina.sh上传到linux执行报错This file is needed to run this program解决

    windows中修改catalina.sh上传到linux执行报错This file is needed to run this program解决 一.发现问题 由于tomcat内存溢出,在wind ...

随机推荐

  1. You must reset your password using ALTER USER

    mac mysql error You must reset your password using ALTER USER statement before executing this statem ...

  2. php5.4 的 php-fpm 的重启

    php 5.3.3以后 源码中已经内嵌了 php-fpm,不用象以前的php版本一样专门打补丁了,只需要在configure的时候添加编译参数即可. 关于php-fpm的编译参数有 –enable-f ...

  3. Java 语言基础之运算符

    使用运算符之后,肯定有返回结果. 六种运算符: 算术运算符 赋值运算符 比较运算符 逻辑运算符 位运算符 三元运算符 1. 算术运算符 加(+), 减(-), 乘(*), 除(/), 取余(%), 自 ...

  4. FastReports_4.14.1 _Cliff手动安装

    首次编译frx15.dproj包的时候,会出错: [DCC Fatal Error] fs15.dpk(59): F1026 File not found: 'fs_ipascal.dcu'原因是因为 ...

  5. django 多数据库时 ORM语句 选择数据库

    多数据库时ORM语句选择数据库 不需要save的操作: 查询(删除的话查询语句后面加一个.delete()即可,修改的话在后面加一个.update()即可): models.表名.objects.us ...

  6. Making the Grade---poj3666(类似离散化+dp)

    题目链接:http://poj.org/problem?id=3666 题意是给出一组数,每个数代表当前位置的地面高度,问把路径修成非递增或者非递减,需要花费的最小代价? ///用dp[i][j]表示 ...

  7. Pandas 通过追加方式合并多个csv

    常用合并 通常用pandas进行数据拼接.合并的方法有: pandas.merge() pandas.concat() pandas.append() 还有一种方式就是通过 pd.to_csv() 中 ...

  8. 修改sql server实例、数据库、表、字段的排序规则

    转自:http://blog.51cto.com/jimshu/1095780 概念与详情请参考:字符编码与排序规则:https://www.cnblogs.com/gered/p/9145123.h ...

  9. PHP 多字节字符串 函数

    参考资料 多字节字符编码方案和他们相关的问题相当复杂,超越了本文档的范围. 关于这些话题的更多信息请参考以下 URL 和其他资源. Unicode materials » http://www.uni ...

  10. vue-cli中的build.js配置文件详细解析

    转载自:https://www.cnblogs.com/ye-hcj/p/7096341.html这是vue-cli脚手架工具的生产环境配置入口 package.json中的"build&q ...