Zend 框架:无法确定临时目录,请手动指定 cache_dir
我只是在学习 Zend 框架.我创建了一个简单的 Zend_Form,当我提交表单时出现以下错误:
I am just learning Zend Framework. I created a simple Zend_Form and when I submitted the form I got following error:
An error occurred
Application error
Exception information:
Message: Could not determine temp directory, please specify a cache_dir manually
Stack trace:
- 0 H:DocumentsIIS_Server_RootzendframeworkendCacheBackend.php(197): Zend_Cache::throwException('Could not deter...')
- 1 H:DocumentsIIS_Server_RootzendframeworkendCacheBackendFile.php(123): Zend_Cache_Backend->getTmpDir()
- 2 H:DocumentsIIS_Server_RootzendframeworkendCache.php(153): Zend_Cache_Backend_File->__construct(Array)
- 3 H:DocumentsIIS_Server_RootzendframeworkendCache.php(94): Zend_Cache::_makeBackend('File', Array, false, false)
- 4 H:DocumentsIIS_Server_RootzendframeworkendLocaleData.php(314): Zend_Cache::factory('Core', 'File', Array, Array)
- 5 H:DocumentsIIS_Server_RootzendframeworkendLocaleFormat.php(808): Zend_Locale_Data::getList('en_US', 'day')
- 6 H:DocumentsIIS_Server_RootzendframeworkendLocaleFormat.php(1118): Zend_Locale_Format::_parseDate('12/12/2010', Array)
- 7 H:DocumentsIIS_Server_RootzendframeworkendDate.php(4765): Zend_Locale_Format::getDate('12/12/2010', Array)
- 8 H:DocumentsIIS_Server_RootzendframeworkendValidateDate.php(175): Zend_Date::isDate('12/12/2010', 'MM-DD-YYYY', NULL)
- 9 H:DocumentsIIS_Server_RootzendframeworkendFormElement.php(1395): Zend_Validate_Date->isValid('12/12/2010', Array)
- 10 H:DocumentsIIS_Server_RootzendframeworkendForm.php(2252): Zend_Form_Element->isValid('12/12/2010', Array)
- 11 H:DocumentsIIS_Server_Rootlocalhostzfprojectszf_cmsapplicationcontrollersBugController.php(30): Zend_Form->isValid(Array)
- 12 H:DocumentsIIS_Server_RootzendframeworkendControllerAction.php(513): BugController->submitAction()
- 13 H:DocumentsIIS_Server_RootzendframeworkendControllerDispatcherStandard.php(295): Zend_Controller_Action->dispatch('submitAction')
- 14 H:DocumentsIIS_Server_RootzendframeworkendControllerFront.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
- 15 H:DocumentsIIS_Server_RootzendframeworkendApplicationBootstrapBootstrap.php(97): Zend_Controller_Front->dispatch()
- 16 H:DocumentsIIS_Server_RootzendframeworkendApplication.php(366): Zend_Application_Bootstrap_Bootstrap->run()
- 17 H:DocumentsIIS_Server_Rootlocalhostzfprojectszf_cmspublicindex.php(26): Zend_Application->run()
- 18 {main}
请求参数:
array (
'controller' => 'bug',
'action' => 'submit',
'module' => 'default',
'author' => '7676',
'email' => 'ankur_gupta555@yahoo.com',
'date' => '12/12/2010',
'url' => 'http://blogs.antarjaal.in/takneek/?p=1354',
'description' => 'tytytyty t',
'priority' => 'low',
'status' => 'new',
'submit' => 'Submit',
)
系统配置:
- Windows 7
- IIS 7.5
- PHP 5.3
- Zend 框架 1.11.4
推荐答案
好吧,它说
"Please specify a cache_dir manually"
就这样吧.
参考指南中的示例:
$frontendOptions = array(
'lifetime' => 7200, // cache lifetime of 2 hours
'automatic_serialization' => true
);
$backendOptions = array(
'cache_dir' => '/path/to/cache' // Directory where to put the cache files
);
// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core',
'File',
$frontendOptions,
$backendOptions);
等价于使用缓存资源插件:
Equivalent when using the Cache Resource Plugin:
resources.cachemanager.database.frontend.name = Core
resources.cachemanager.database.frontend.customFrontendNaming = false
resources.cachemanager.database.frontend.options.lifetime = 7200
resources.cachemanager.database.frontend.options.automatic_serialization = true
resources.cachemanager.database.backend.name = File
resources.cachemanager.database.backend.customBackendNaming = false
resources.cachemanager.database.backend.options.cache_dir = "/path/to/cache"
resources.cachemanager.database.frontendBackendAutoload = false
参考:
- http://framework.zend.com/manual/en/zend.cache.backends.html#zend.cache.backends.file
- http://framework.zend.com/manual/en/zend.cache.introduction.html
- http://zendframework.com/manual/en/zend.application.available-resources.html
相关文章