出现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 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的解决办法的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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. ...
- 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(): ...
- 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* ...
- 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 ...
- 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 ...
- 解决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 ...
随机推荐
- springbootboot 语句
-- ------------------------------ Table structure for `user`-- ----------------------------DROP TABL ...
- 微信小程序常用API组件开发
关于小程序 张小龙定义小程序: 1.不需要下载安装即可使用: 2.用完即走,不用关心是否安装太多应用: 3.应用无处不在,随时可用. 特点: 1.适合业务逻辑简单的应用: 2,.适合低频应用: 3.适 ...
- vue开发环境及vue相关
一.安装node.js Vue项目通常通过webpack工具来构建,而webpack命令的执行是依赖node.js的环境的,所以首先要安装node.js. 二.安装cnpm cnpm是淘宝对npm的镜 ...
- Least Common Ancestors
/* Least Common Ancestors * Au: Small_Ash */ #include <bits/stdc++.h> using namespace std; con ...
- inline-block空隙怎么解决
方法一:移除空格 元素间留白间距出现的原因就是标签段之间的空格,因此,去掉HTML中的空格,自然间距就木有了.考虑到代码可读性,显然连成一行的写法是不可取的,我们可以: <div class=& ...
- C++ placement new与内存池
参考:https://blog.csdn.net/Kiritow/article/details/51314612 有些时候我们需要能够长时间运行的程序(例如监听程序,服务器程序)对于这些7*24运行 ...
- MySQL 5.7配置文件
原文:http://www.voidcn.com/article/p-zrikccdi-hr.html # MySql5.7配置文件my.cnf设置[client]port = 3306socket ...
- Tomcat负载均衡、调优核心应用进阶学习笔记(二):Tomcat前世今生、安装、配置文件详细说明、tomcat应用程序部署、webapp 体系结构、tomcat运行方式
文章目录 Tomcat前世今生 安装 配置文件详细说明 tomcat应用程序部署 webapp 体系结构 tomcat运行方式 Tomcat前世今生 java体系: 1 java程序设计语言 2 ja ...
- HDU4578-Transformation-线段树的加、乘、变、次方操作
Sample Input 5 5 3 3 5 7 1 2 4 4 4 1 5 2 2 2 5 8 4 3 5 3 0 0 Sample Output 307 7489 题意:给出n,m,表示该数有n个 ...
- 2019牛客多校第⑨场D Knapsack Cryptosystem(折半搜索)
原题:https://ac.nowcoder.com/acm/contest/889/D 题意: 给定大小为n(<=36)的集合a,整数s,求a的一个和为s的子集(有且只有一个) 思路: 直接搜 ...