It is not safe to rely on the system's timezone settings

在写php文件上传程序时有时会出现这样的警告:

Upload: 屏幕截图2014-09-28_160214.png
Type: image/png
Size: 66.84765625 Kb
Temp file: D:\Users\Aven\AppData\Local\Temp\php742F.tmp

Warning: move_uploaded_file() [function.move-uploaded-file]: 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 F:\PHP\upload_file.php on line 26

Warning: move_uploaded_file(upload/屏幕截图2014-09-28_160214.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in F:\PHP\upload_file.php on line 26

Warning: move_uploaded_file() [function.move-uploaded-file]: 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 F:\PHP\upload_file.php on line 26

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘D:\Users\Aven\AppData\Local\Temp\php742F.tmp‘ to ‘upload/屏幕截图2014-09-28_160214.png‘ in F:\PHP\upload_file.php on line 26
Stored in: upload/屏幕截图2014-09-28_160214.png

这是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决: 
1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即 <?php date_default_timezone_set("PRC"); ?>就可以了。 
2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。

这里选用修改配置文件的方式解决问题:

用Notepad++打开php.ini,

查找“date.timezone”,把语句前的分号去掉,值设置为“PRC”,重启FastCGI服务,问题解决。

It is not safe to rely on the system's timezone settings

时间: 2024-10-08 18:43:27

It is not safe to rely on the system's timezone settings的相关文章

Warning: date(): It is not safe to rely on the system&#39;s timezone settings.

PHP调试的时候出现了警告: 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中如果没有设置部

PHP Warning: Unknown: It is not safe to rely on the system&#39;s timezone settings

PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings 解决: 2.找到date.timezone,修改为 date.timezone = RPC,后保存. [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone =  修改为 [D

解决php的It is not safe to rely on the system’s timezone settings的问题

访问网站提示: 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, y

PHP Warning: strtotime(): It is not safe to rely on the system&#39;s timezone settings.

有三种解决办法: 1. php文件中设置时区 <?php date_default_timezone_set('Asia/Shanghai'); echo strtotime('2012-9-3'); ?> 2. 设置php.ini data.timezone = "Asia/Shanghai" 3. 设置date_timezone.ini date.timezone = "Asia/Shanghai" 如果使用zend server ,在 Server

PHP Warning: date(): It is not safe to rely on the system&#39;s timezone settings.

OSSEC安装结束后运行,运行以下命令却抛错 cat /opt/ossec/logs/alerts/alerts.log 具体抛错内容: ** Alert 1468897672.2164786: mail - syslog,errors, 2016 Jul 19 11:07:52 localhost->/var/log/httpd/error_log Rule: 1002 (level 2) -> 'Unknown problem somewhere in the system.' [Tue

解决方案:Warning: phpinfo(): It is not safe to rely on the system&#39;s timezone settings.

(1)打开phpinfo();时在date地方会出现如下提示: 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 y

Warning: date(): It is not safe to rely on the system&#39;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* 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 warn

PHP Warning: phpinfo(): It is not safe to rely on the system&#39;s timezone setting

错误描述: 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

PHP Warning: date() [function.date]: It is not safe to rely on the system&#39;s timezone

在用PHP5.3以上的PHP版本时,只要是涉及时间的会报一个 "PHP Warning: date() [function.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 th