memcached 无法在 codeigniter 2.1.0 上运行
一段时间以来我一直在努力让它发挥作用,但我做不到。我正在 Windows 7 64 位上工作,我有 Memcached 服务器作为服务运行,我在 PHP 5.3.8 中有 php_memcached.dll 扩展,当我在 Codeigniter 中的应用程序上调用它时,我以正确的方式执行此操作(我认为)。
$this->load->driver('cache', array('adapter' => 'memcached', 'backup' => 'file'));
var_dump($this->cache->memcached->is_supported());
die();
但它抛出一个错误,所以我不知道我做错了什么。当我这样调用它时:
$this->load->driver('cache', array('adapter' => 'memcached', 'backup' => 'file'));
$data = $this->cache->memcached->get('data_' . $idData);
我收到此 PHP 错误:
Fatal error: Call to a member function get() on a non-object in E:\workspace\example\system\libraries\Cache\drivers\Cache_memcached.php on line 50
感谢您的帮助:-)
I have been trying to make it work for sometime now, but I can't. I am working on a Windows 7 64bits, I have the Memcached Server running as Service, I have the php_memcached.dll extension in the PHP 5.3.8 and when I call it on the app in Codeigniter I do it the right way (I Think).
$this->load->driver('cache', array('adapter' => 'memcached', 'backup' => 'file'));
var_dump($this->cache->memcached->is_supported());
die();
but it throws a false so I don't know what I am doing wrong. When I call it like this:
$this->load->driver('cache', array('adapter' => 'memcached', 'backup' => 'file'));
$data = $this->cache->memcached->get('data_' . $idData);
I get this PHP error:
Fatal error: Call to a member function get() on a non-object in E:\workspace\example\system\libraries\Cache\drivers\Cache_memcached.php on line 50
Thanks for the help :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
CI 驱动程序正在寻找 Apache 模块,但在 WIN 中我们主要使用 PHP 类 Memcache。
尝试更改 /system/libraries/Cache/drivers/Cache_memcached.php 中的第 165 行
对我来说,它在从 Memcached 更改为 Memcache 后有效。
The CI driver is looking for the Apache Module, but in WIN we use mostly the PHP-Class Memcache.
Try to change Line 165 in /system/libraries/Cache/drivers/Cache_memcached.php
For me it works after changing from Memcached to Memcache.
我知道这已经很旧了,但我刚刚遇到了同样的问题。
在 Windows 上,您应该使用“Memcache”而不是“Memcached”。为此,请按照本页上的说明进行操作:
http://www.leonardaustin.com /technical/how-to-install-memcached-on-xampp-on-windows-7
然后,要使其在 CI 中工作,您需要进行两个小更改\system\libraries\Cache\drivers\Cache_memcached.php:
在函数 is_supported() 中,替换:
为:
在函数 _setup_memcached() 中,替换:
为:
I know this is old, but I just came across the same issue.
On Windows, you should be using "Memcache" rather than "Memcached". To do this, follow the instructions on this page:
http://www.leonardaustin.com/technical/how-to-install-memcached-on-xampp-on-windows-7
Then, to get it working in CI, you'll need to make two small changes to \system\libraries\Cache\drivers\Cache_memcached.php:
In function is_supported(), replace:
With:
And in function _setup_memcached(), replace:
With: