【发布时间】:2014-02-16 08:28:07
【问题描述】:
我有关于 zend cache_dir 的问题。 我尝试将我的站点从一台服务器转移到另一台服务器,并且它可以工作。 但是,当我尝试访问该站点时,它会显示此错误:
PHP Fatal error: Uncaught exception 'Zend_Cache_Exception' with message 'cache_dir "/tmp" must be a directory' in /home/aiesorgm/public_html/gcpi/library/Zend/Cache.php:209
Stack trace:
- #0 /home/aiesorgm/public_html/gcpi/library/Zend/Cache/Backend/File.php(178): Zend_Cache::throwException('cache_dir "/tmp...')
- #1 /home/aiesorgm/public_html/gcpi/library/Zend/Cache/Backend/File.php(129): Zend_Cache_Backend_File->setCacheDir('/tmp')
- #2 /home/aiesorgm/public_html/gcpi/library/Zend/Cache.php(153): Zend_Cache_Backend_File->__construct(Array)
- #3 /home/aiesorgm/public_html/gcpi/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('File', Array, false, false)
- #4 /home/aiesorgm/public_html/gcpi/application/Bootstrap.php(55): Zend_Cache::factory('Page', 'File', Array, Array)
- #5 /home/aiesorgm/public_html/gcpi/library/Zend/Application/Bootstrap/BootstrapAbstract.php(669): Bootstrap->_initCache()
- #6 /home/aiesorgm/public_html/gcpi/library/Zend/Application/Bootstrap/BootstrapAbstract.php(622): Zend_Application_Bootstrap_BootstrapAbstract-> in /home/aiesorgm/public_html/gcpi/library/Zend/Cache.php on line 209
我已经尝试了可以从 stackoverflow 获得的所有解决方案,但仍然无法正常工作。 我还在公共文件夹中创建了 tmp 目录并将权限更改为 777。
应用程序/Bootstrap.php
protected function _initCache() {
$info = Zend_Registry::get('info');
$backendOptions = array(
'cache_dir' => sys_get_temp_dir(),
'hashed_directory_level' => 1,
'file_name_prefix' => 'style',
'automatic_cleaning_factor' => 1
);
$frontendOptions = array(
'lifetime' => $info['cache']['lifetime'],
'automatic_serialization' => true,
'caching' => ($info['cache']['enabled'] == '1') ? true : false,
);
$cache = Zend_Cache::factory('Page', 'File', $frontendOptions, $backendOptions);
Zend_Registry::set('cache', $cache);
}
/library/Zend/Cache/Backend/File.php
protected $_options = array(
'cache_dir' => null,
'file_locking' => true,
'read_control' => true,
'read_control_type' => 'crc32',
'hashed_directory_level' => 0,
'hashed_directory_perm' => 0700,
'file_name_prefix' => 'zend_cache',
'cache_file_perm' => 0600,
'metadatas_array_max_size' => 100
);
文件夹结构
应用
- 配置
- 控制器
- 表格
- 布局
- 型号
- 查看
文档
图书馆
公开
- CSS
- js
- 图片
- tmp
- .htaccess
- index.php
花 10Q 时间阅读这篇文章。
【问题讨论】:
标签: php .htaccess twitter-bootstrap zend-framework caching