什么是在PHP 5.3.6上使用getdate()触发此PHP解析错误?

时间:2011-08-07 02:04:08

标签: php timezone getdate

我得到了getdate();在我的Etomite安装的每一页上都有PHP解析错误。

由于我尝试将服务器时区设置为EST / EDT,但错误仍然存​​在。我还搜索了Etomite论坛和StackOverflow,但找不到解决方案。

注意:服务器最近已更新为PHP 5.3.6

这是错误,任何帮助将不胜感激!


Etomite encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »

PHP error debug
Error:  getdate(): 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/Los_Angeles' for 'PDT/-7.0/DST' instead 
Error type/ Nr.:    Warning - 2 
File:   /var/www/vhosts/xxxxxxxxxxxxx.ca/httpdocs/manager/includes/visitor_logging.inc.php 
Line:   81 
Line 81 source: $accesstime = getdate(); 

Parser timing
MySQL:  0.0000 s s  (0 Requests)
PHP:    0.0086 s s 
Total:  0.0086 s s

1 个答案:

答案 0 :(得分:2)

如果未指定时区,PHP将报告E_STRICT错误。在您的情况下,违规通话发生在visitor_logging.inc.php.

的第81行

在包含该文件之前的某个地方,您可以使用以下调用设置时区:

// Use your own correct time zone
date_default_timezone_set('America/Los_Angeles');