2011-11-26 28 views
3

我收到以下錯誤CakePHP中:CakePHP中的時區錯誤?

Warning (2): strtotime() [http://php.net/function.strtotime]: 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 'Europe/Berlin' for 'CEST/2.0/DST' instead [ROOT/cakephp/cake/libs/cache.php, line 570]

而且我收到通知:

Trying to get property of non-object in /htdocs/cakephp/cake/libs/cache/file.php on line 248 Fatal error: Call to a member function cd() on a non-object in /htdocs/cakephp/cake/libs/cache/file.php on line 248

我添加了這行date_default_timezone_set("America/Anchorage");[cake base directory]/libs/cache.php試圖解決問題的頂部。 但錯誤仍然存​​在。

任何提示?

回答

14

您必須在app/config/core.php中取消date_default_timezone_set的註釋並且警告消失。

+5

這是解決方案,不要浪費你的其他地方時間:d – Rifat

+1

的確,這是取消註釋行... – Mortimer

3

/app/config/core.php:

/** 
* If you are on PHP 5.3 uncomment this line and correct your server timezone 
* to fix the date & time related errors. 
*/ 
    //date_default_timezone_set('UTC');