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
出现这个错误的原因,主要是因为php.ini里面的时区没有进行设置,可以设置一下,例如:
vi /etc/php.ini
然后找到timezone
将时区设为,例如:Asia/Shanghai

PS: 本来以为通过上述的方式是可以解决问题的,但是经测试,在php5.3版本下,并不能解决问题。

具体操作方式如下:
1、在php配置文件中添加timezone的配置(参照debian的配置规则,添加小的配置规则文件即可,好维护,自定义性好)
~# vim /etc/php/cli-php5.3/ext-active/date_timezone.ini
date.timezone = "Asia/Shanghai"
~ # env-update
~ # source /etc/profile
自定义的文件放在cli-php5.3/ext-active目录中,是因为php默认是采用cli方式,另外ext-active目录是表示启用特性的专用目录,这个可以从/etc/env.d/20php5.3文件中看出来
MANPATH="/usr/lib/php5.3/man/"
CONFIG_PROTECT_MASK="/etc/php/cli-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/apache2-php5.3/ext-active/"
2、在出现错误提示的php文件中添加date_default_timezone_set('Asia/Shanghai');位置是在<?php   ?>中
注:
在 某些参考资料中是说这两个方法任选其一就可,但经我测试,必须两个方法同时使用,才不会再出现错误提示。经实测其实第二个方法并不需要在每个出现错误提示 的PHP文件中添加,只需在其中一个PHP文件中添加即可。另外添加的时区不需要与提示中的时区一样,比如系统给我的提示是Chongqing,但我设置 成Shanghai也是一样的,当然这个时间也是与我系统的时区设置是一样的。

http://blog.163.com/litianyichuanqi@126/blog/static/1159794412012815115730262/

php时区设置 warning: strtotime(): It is not safe to rely on the system's timezone settings的更多相关文章

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

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

  5. 出现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 ...

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

  7. [服务器时区问题]PHP Warning: strftime(): It is not safe to rely on the system's timezone set

    PHP Warning: strftime(): It is not safe to rely on the system's timezone set 当运行一些程序时,在httpd日志中会有如下警 ...

  8. PHP Warning: strftime(): It is not safe to rely on the system's timezone set

    当运行一些程序时,在httpd日志中会有如下警告日志: PHP Warning:  strftime(): It is not safe to rely on the system's timezon ...

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

随机推荐

  1. linux常用命令:top 命令

    top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器.下面详细介绍它的使用方法.top是 一个动态显示过程,即可以通过用户按键来不断刷 ...

  2. 配置QT Mingw & opencv

    可以直接从这里下载别人构建好的 https://github.com/huihut/OpenCV-MinGW-Build --------------------------------------- ...

  3. python之路----面向对象的封装特性

    封装 [封装] 隐藏对象的属性和实现细节,仅对外提供公共访问方式. 广义上面向对象的封装 :代码的保护,面向对象的思想本身就是一种只让自己的对象能调用自己类中的方法 狭义上的封装 —— 面向对象的三大 ...

  4. Python Web学习笔记之WebSocket 通信过程与实现

    一.什么是 WebSocket ? WebSocket 是一种标准协议,用于在客户端和服务端之间进行双向数据传输.但它跟 HTTP 没什么关系,它是基于 TCP 的一种独立实现. 以前客户端想知道服务 ...

  5. Python学习笔记之@classmethod与@staticmethod

    Python面向对象编程中,类中定义的方法可以是 @classmethod 装饰的 类方法 ,也可以是 @staticmethod 装饰的 静态方法 ,用的最多的还是不带装饰器的 实例方法 ,如果把这 ...

  6. P2571 [SCOI2010]传送带

    P2571 [SCOI2010]传送带 三分套三分. 前提条件:P3382 [模板]三分法 三分,求区间内单峰函数的最大/最小值. 我们把两条线段都跑三分,先ab后cd,求出最小值. 可以直接将二维坐 ...

  7. MFC制作OCX

    1.新建工程 注意选择显示时注册,免得后面又去手动注册 2.工程解释,一般ocx是看类视图而不是解决方案 ①.xxxApp:类似整个工程的入口,有xxxApp.h和xxxApp.cpp,工程的初始化, ...

  8. vim的加密和解密?

    vim中出现的错误提示含义: 参考: http://blog.csdn.net/u014599371/article/details/43955169 E488: trailing character ...

  9. 骗访问量的机房人物列传by xMinh

    作者:$xMinh$ 人物列传·Refun(Aufun,虚凡,人赢) 机房最人赢的人赢,上过表白墙的男人 在宿舍公然开设情感讲座和人赢培训班,教学成果显著,他的徒弟要么gay了要么凉了 认识的人极其广 ...

  10. C#中配置文件保存的路径

    http://www.codeproject.com/Tips/350010/Saving-User-Settings-in-Winform-Application 外网上找的资料 winform提供 ...