2013-04-16 21 views
3

你好的人,我有一些問題與Zend框架。
我第一次得到了以下信息: 消息:
無法確定temp目錄,請手動指定cache_dir的。
我搜索谷歌和發現這個職位:Zend Framework : Could not determine temp directory, please specify a cache_dir manually
我讀了它,現在當我填寫表格,我得到以下錯誤:
(無處不在這裏我把..錯誤表示域)

留言:cache_dir的必須是一個目錄消息:cache_dir的必須是一個目錄

- #0 /home/daan/domains/../library/Zend/Cache/Backend/File.php(154): Zend_Cache::throwException('cache_dir must ...') 
- #1 /home/daan/domains/../library/Zend/Cache/Backend/File.php(121): Zend_Cache_Backend_File->setCacheDir('/domains/daan.h...') 
- #2 /home/daan/domains/../library/Zend/Cache.php(153): Zend_Cache_Backend_File->__construct(Array) 
- #3 /home/daan/domains/../library/Zend/Cache.php(94): Zend_Cache::_makeBackend('File', Array, false, false) 
- #4 /home/daan/domains/../library/Zend/Locale/Data.php(307): Zend_Cache::factory('Core', 'File', Array, Array) 
- #5 /home/daan/domains/../library/Zend/Locale/Format.php(796): Zend_Locale_Data::getList('nl_NL', 'day') 
- #6 /home/daan/domains/../library/Zend/Locale/Format.php(1106): Zend_Locale_Format::_parseDate('16-02-2013', Array) 
- #7 /home/daan/domains/../library/Zend/Date.php(4763): Zend_Locale_Format::getDate('16-02-2013', Array) 
- #8 /home/daan/domains/../library/Zend/Validate/Date.php(175): Zend_Date::isDate('16-02-2013', 'MM-DD-YYYY', NULL) 
- #9 /home/daan/domains/../library/Zend/Form/Element.php(1391): Zend_Validate_Date->isValid('16-02-2013', Array) 
- #10 /home/daan/domains/../library/Zend/Form.php(2135): Zend_Form_Element->isValid('16-02-2013', Array) 
- #11/home/daan/domains/../application/controllers/BugController.php(27): Zend_Form->isValid(Array) 
- #12 /home/daan/domains/../library/Zend/Controller/Action.php(513): BugController->submitAction() 
- #13 /home/daan/domains/../library/Zend/Controller/Dispatcher/Standard.php(289): Zend_Controller_Action->dispatch('submitAction') 
- #14 /home/daan/domains/../library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) 
- #15 /home/daan/domains/../library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch() 
- #16 /home/daan/domains/../library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() 
- #17 /home/daan/domains/../public_html/index.php(26): Zend_Application->run() 
- #18 {main} 

的application.ini:

resources.cachemanager.configFiles.frontend.name = File 
resources.cachemanager.configFiles.frontend.customFrontendNaming = false 
resources.cachemanager.configFiles.frontend.options.lifetime = false 
resources.cachemanager.configFiles.frontend.options.automatic_serialization = true  
resources.cachemanager.configFiles.backend.name = File 
resources.cachemanager.configFiles.backend.customBackendNaming = false 
resources.cachemanager.configFiles.backend.options.cache_dir = APPLICATION_PATH  "/../tmp" 
resources.cachemanager.configFiles.frontendBackendAutoload = false 

Initcache:

protected function _initCaching() { 
$frontend = array(
'lifetime' => $time, 
'automatic_serialization' => true 
); 
$backend = array(
'cache_dir' => sys_get_temp_dir(), 
); 
$cache = Zend_Cache::factory('core', 'File', $frontend, $backend); 
Zend_Registry::set('cache', $cache); 

}

文件夾結構:
htpasswd的
應用
的AWStats

日誌
public_ftp
的public_html
TMP

+0

請編輯您的問題,包括你的緩存配置 –

+0

@TimFountain我不明白你的問題,你的意思是我的application.ini我下面的一本書,我是新來的Zend –

+0

是,與緩存相關的application.ini部分。或者如果你的引導類有一個_initCache()函數,那麼。 –

回答

7

cache_dir的必須是一個目錄:

這個問題通常來的時候,你的代碼遷移到另一臺主機或服務器。主要有兩種解決方案,這個問題

1 - 確保您的緩存目錄是可寫的,或者你可以寫入到Magento的

但有時這種情況不工作,所以這裏的替代解決方案的變種文件夾中。回到這個位置的lib/Zend公司/緩存/後端/ 和開放file.php文件,你會看到的代碼是這樣的

protected $_options = array(
     'cache_dir' => null, 
     'file_locking' => true, 
     'read_control' => true, 
     'read_control_type' => 'crc32', 
     'hashed_directory_level' => 0, 
     'hashed_directory_umask' => 0700, 
     'file_name_prefix' => 'zend_cache', 
     'cache_file_umask' => 0600, 
     'metadatas_array_max_size' => 100 
    ); 

改變這種代碼如下

protected $_options = array(
     'cache_dir' => '/var/www/html/webkul/magento/tmp', 
     'file_locking' => true, 
     'read_control' => true, 
     'read_control_type' => 'crc32', 
     'hashed_directory_level' => 0, 
     'hashed_directory_umask' => 0700, 
     'file_name_prefix' => 'zend_cache', 
     'cache_file_umask' => 0600, 
     'metadatas_array_max_size' => 100 
    ); 

分配根據您的配置,cache_dir的路徑。

+0

我仍然有同樣的錯誤。 –

+0

'cache_dir'=>路徑是你的服務器路徑,你需要根據你的服務器路徑修改它嗎? – liyakat

+0

謝謝幫助:) –

0

可能Zend公司無法ŧ找到你的緩存目錄。嘗試SE這在bootstrap.php中這樣

protected function _initCache() { 
    $frontend = array(
     'lifetime' => $time, 
     'automatic_serialization' => true 
    ); 
    $backend = array(
     'cache_dir' => sys_get_temp_dir(), /**automatically detects**/ 
    ); 
    $cache = Zend_Cache::factory('core', 'File', $frontend, $backend); 
    Zend_Registry::set('cache', $cache); 
} 
+0

這不起作用@chandresh_cool。我甚至無法打開表格現在我得到這個錯誤: 致命錯誤:未知的異常'Zend_Cache_Exception'帶有消息'cache_dir必須是目錄'在 儘管我chmodded它到777 –

0

從引導中刪除_initCaching函數,你不應該有這個和application.ini條目,因爲它們都試圖設置相同的事情(但使用不同的緩存位置)。

你的緩存目錄設置爲APPLICATION_PATH "/../tmp" - 即一個名爲「TMP」在您的應用程序的根目錄下(而不是在應用程序文件夾)。你是否100%確定你的tmp文件夾存在於這個位置?如果是這樣,你可以嘗試改變應用程序。ini配置使用全路徑代替:

resources.cachemanager.configFiles.backend.options.cache_dir = "/home/daan/domains/whatever/tmp" 

只是爲了看看是否解決了這個問題。

如果仍然無法正常工作,請發佈有關應用程序文件結構的更多信息。

0

這個問題的答案是打開File.php文件並更改tmp文件夾的路徑。 此問題主要出現在您將網站從一臺服務器轉移到另一臺服務器時。當您傳輸站點時,tmp文件夾的路徑不會更改爲新的路徑。所以編輯file.php並更改tmp文件夾的路徑。在Magento的目錄

0

magento root

創建 「TMP」 的文件解決了這個錯誤我。 我能夠輕鬆訪問管理員

0

爲您的緩存目錄分配完整路徑。例如,

'cache_dir' => '/var/www/html/var/cache1', 
相關問題