我正在尝试将 Memcached 集成到我的 Zend Framework 网站中以加快 Ajax 调用,但我遇到了麻烦。我尝试用这个函数在我的引导程序中初始化它:
public function _initMemcached(){
$memcache = new Memcached;
$memcache->connect('127.0.0.1', 11211);
Zend_Registry::set('memcached', $memcache);
}
但这只会引发php找不到类的错误。根据托管我网站的数据中心,Memcached 应该安装在 中/root/memcached-1.4.13/
,所以我尝试添加一个 require_once,现在它抛出了这个错误:
Warning: require_once() [function.require-once]: open_basedir restriction in effect. File(/root/memcached-1.4.13/Memcached.php) is not within the allowed path(s):
我试图在我的引导程序中重置 open_basedir,但它似乎不起作用。我怎样才能摆脱这个错误,以便我可以实例化一个 memcached 对象并继续我的业务?
编辑:
数据中心告诉我 memcached.so 在里面,/usr/local/lib/php/extensions/no-debug-non-zts-###/
但我无法通过 SSH 访问它来确认。我将extension_dir
in php.ini 设置为/usr/local/lib/php/extensions/no-debug-non-zts-###/
并且我有extension=memcached.so
,但我仍然找不到 Class。我的设置不正确吗?