【发布时间】:2015-07-29 15:59:38
【问题描述】:
运行 ZF1 并链接到 phpbb 论坛的站点。
将phpbb从3.0.12更新到3.1.5(3.0.12没有这个问题)
当我直接访问论坛时,它可以正常工作。
但是通过框架访问它时
(例如访问data['user_unread_privmsg']等用户功能)
我收到以下错误:
Call to undefined method Zend_Cache_Core::get() in /forum/phpbb/db/driver/mysqli.php on line 119
我已经通过使用 xe-debug 进行了跟踪,它在以下函数处停止:
/**
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
global $cache;
if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false)
{
$result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version');
if ($result !== null)
{
$row = @mysqli_fetch_assoc($result);
$this->sql_server_version = $row['version'];
if (!empty($cache) && $use_cache)
{
$cache->put('mysqli_version', $this->sql_server_version);
}
}
@mysqli_free_result($result);
}
return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version;
}
导致错误的确切行如下if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false)
我的 ZF 缓存设置(适用于其他缓存项)看起来像这样
$cachedir = APPLICATION_PATH . '/public/tmp/cache';
if (!is_dir($cachedir)) {
mkdir($cachedir, 0755, true); // make directory if it doesn't exist
}
$frontendOptions = array(
'lifetime' => 600,
'automatic_serialization' => true
);
$backendOptions = array(
'cache_dir' => $cachedir
);
// getting a Zend_Cache_Core object
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
Zend_Registry::set("cache", $cache);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
$cache = Zend_Cache::factory('Core', 'APC', $frontendOptions);
Zend_Registry::set("apc_cache", $cache);
任何想法如何解决这个问题?
(我已经删除了旧缓存,将 tmp/cache 权限设置为 777 等)
【问题讨论】:
标签: caching zend-framework mysqli phpbb