当我请求在服务器上将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>

当前回答

解决这个问题有两种方法

首先,在php.ini文件中输入默认时区

date.timezone = "America/New_York"

在php.ini中设置好时区后,重新启动服务器

其次,改变运行时间 根据您的需要分配时区

date_default_timezone_set('America/New_York');

其他回答

解决这个问题有两种方法

首先,在php.ini文件中输入默认时区

date.timezone = "America/New_York"

在php.ini中设置好时区后,重新启动服务器

其次,改变运行时间 根据您的需要分配时区

date_default_timezone_set('America/New_York');

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

在你的连接页面中输入如下代码:date_default_timezone_set("Africa/Johannesburg");基于你当前的位置。

在index.php文件中添加以下内容。当我把我的应用程序从XAMPP服务器迁移到Apache 2.2和PHP 5.4时,我第一次遇到了这个问题……

我建议你在index.php文件中,而不是在php.ini文件中。

if( ! ini_get('date.timezone') )
{
    date_default_timezone_set('GMT');
}

当你纠正不兼容时,一个快速的解决方案是禁用index.php文件中的错误报告:

将下面的行插入到你的index.php下面define(' _JEXEC ', 1);

error_reporting( E_ERROR | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR |
E_COMPILE_WARNING );