当我请求在服务器上将PHP版本从5.2.17更新到PHP 5.3.21时,我得到了这个错误。

<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  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 'America/New_York' for 'EDT/-4.0/DST' instead</p>
<p>Filename: libraries/Log.php</p>
<p>Line Number: 86</p>

</div>
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 'America/New_York' for 'EDT/-4.0/DST' instead in /filelocation right here/system/libraries/Log.php on line 86

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 'America/New_York' for 'EDT/-4.0/DST' instead in /filelocation right here/system/libraries/Log.php on line 99
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Warning</p>
<p>Message:  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 'America/New_York' for 'EDT/-4.0/DST' instead</p>
<p>Filename: libraries/Log.php</p>
<p>Line Number: 99</p>

</div>

当前回答

如果你使用Plesk,试试它,首先,打开PHP设置,在页面底部,更改日期。从DEFAULT到UTC的时区。

其他回答

我总是在codeigniter的根index.php中保留这一行,这样我的代码可以在任何服务器上工作

date_default_timezone_set('Asia/Dhaka');

此处支持的时区列表

这个问题一直困扰我一段时间,因为我试图注入一个“createbucket.php”脚本到作曲家,我一直被告知我的时区是不正确的。

最后,解决这个问题的唯一方法是: $ sudo nano /etc/php.ini

搜索时区

[Date]
; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = UTC

确保你移除;

最后

$ sudo service httpd restart

然后你就可以出发了:)

你可以在你的.htaccess文件中设置时区

php_value date.timezone UTC
<? date_default_timezone_set('Europe/Istanbul'); ?>

对于php(或您的位置)。

您可能需要将时区放在php.ini文件的配置行中。你应该在你的php.ini文件中有一个这样的块:

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

如果没有,添加它(用您的时区替换)。配置完成后,确保重新启动httpd (service httpd restart)。

下面是支持的时区列表。