2010-12-13 15 views
-4
Warning (2): strtotime() [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 'Asia/Calcutta' for '5.5/no DST' instead [CORE\cake\libs\cache.php, line 570] 
Code | Context 

$settings = array(
"engine" => "File", 
"path" => "C:\xampp\htdocs\cakephp\app\tmp\cache\persistent\", 
"prefix" => "cake_core_", 
"lock" => false, 
"serialize" => true, 
"isWindows" => true, 
"duration" => "+10 seconds", 
"probability" => 100 
) 

strtotime - [internal], line ?? 
CacheEngine::init() - CORE\cake\libs\cache.php, line 570 
FileEngine::init() - CORE\cake\libs\cache\file.php, line 81 
Cache::_buildEngine() - CORE\cake\libs\cache.php, line 151 
Cache::config() - CORE\cake\libs\cache.php, line 126 
Configure::__loadBootstrap() - CORE\cake\libs\configure.php, line 421 
Configure::getInstance() - CORE\cake\libs\configure.php, line 52 
include - CORE\cake\bootstrap.php, line 38 
[main] - APP\webroot\index.php, line 76 


Notice: Trying to get property of non-object in C:\xampp\htdocs\cakephp\cake\libs\cache\file.php on line 248 

Fatal error: Call to a member function cd() on a non-object in C:\xampp\htdocs\cakephp\cake\libs\cache\file.php on line 248 
+5

date_default_timezone_set行......是嗎?你是否也想制定一個問題? – deceze 2010-12-13 11:59:38

+7

有幸能夠從其他無用轉儲錯誤消息中獲得問題的能力,我可以看出爲什麼凡人可能會遇到這種問題:-)也許,考慮到SO是一個問答網站,您應該問一個問題。 – paxdiablo 2010-12-13 11:59:57

回答

44

/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'); 
+0

我用過它。現在我收到錯誤:致命錯誤:類'PDO'找不到在/var/www/html/authbridge/lib/Cake/Model/Datasource/Database/Mysql.php在線177 – 2012-07-13 12:15:11

+0

謝謝你的工作。 – 2014-01-30 16:15:34

+1

另外,在Cakephp 2.x下,您必須取消註釋並編輯'//Configure::write('Config.timezone','Europe/Paris');'line。 – Eugen 2015-01-02 21:54:09

1

非常警告提到有問題的功能,你是否搜索過這個功能? Here's what it says in the docs

Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT or E_WARNING message if using the system settings or the TZ environment variable. See also date_default_timezone_set()

換句話說,你應該明確地設置TZ爲您的服務器,either in php.ini,或使用date_default_timezone_set()

4

這是非常好,在這裏和其他地方的記錄。 Timezone and more problems with Cakephp 1.3 and PHP 5.3.2

成爲精通開發人員的一部分是努力解決自己的問題。這就是你學習的方式。如果對這個問題有如此多的報道,那麼你不可能在這裏找到同情的耳朵,因爲每個人都知道你自己並沒有做出任何努力。

+0

這是一個有點自負的隊友,OP在這裏尋求幫助。 – elliotrock 2016-03-15 07:10:48

0

要刪除此E_STRICT或E_WARNING消息請取消註釋app/config/core.php

相關問題