php PHP找不到保存处理程序memcache
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4057777/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP Can't find save handler memcache
提问by Jeff
I'm busting my brains over this issue (it should be straightforward), but can't seem to find a solution so hopefully one of you can help me. I'm trying to store sessions using php's memcache extension.
我正在为这个问题绞尽脑汁(应该很简单),但似乎找不到解决方案,所以希望你们中的一个能帮助我。我正在尝试使用 php 的 memcache 扩展来存储会话。
I'm running MAMP and have installed the extension correctly (I think...it shows up when I do phpinfo), am running the daemon and can connect to it through php, using something like this:
我正在运行 MAMP 并正确安装了扩展程序(我认为......它会在我执行 phpinfo 时显示),正在运行守护程序并且可以通过 php 连接到它,使用如下内容:
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
So I KNOW that php can communicate with the daemon. The problem is when I enable memcache session storage in php.ini and try to do a session_start() it gives me an error that it "Cannot find save handler memcache". This is what is in my php.ini:
所以我知道 php 可以与守护进程通信。问题是当我在 php.ini 中启用 memcache 会话存储并尝试执行 session_start() 时,它给了我一个错误“找不到保存处理程序 memcache”。这是我的 php.ini 中的内容:
session.save_handler = memcache
session.save_path = "tcp://127.0.0.1:11211"
Any help would be much appreciated =(
任何帮助将不胜感激=(
Some additional info:
一些额外的信息:
Installed using the directions here:
使用此处的说明安装:
http://lullabot.com/articles/setup-memcached-mamp-sandbox-environment
http://lullabot.com/articles/setup-memcached-mamp-sandbox-environment
on OSX 1.6.4 and i put the .so file in the proper directory
在 OSX 1.6.4 上,我将 .so 文件放在正确的目录中
回答by kijin
Memcached, not Memcache. Same as the name of the class.
Memcached,而不是 Memcache。与类名相同。
session.save_handler = memcached
EDITsince the OP indicated that it was just a typo.
编辑,因为 OP 表示这只是一个错字。
There are some similar stories here:
http://www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/
http://phpslacker.com/2009/03/02/php-session-clustering-with-memcache/
这里有一些类似的故事:
http: //www.dotdeb.org/2008/08/25/storing-your-php-sessions-using-memcached/
http://phpslacker.com/2009/03/02/php -session-clustering-with-memcache/
Did you say "yes" when the installer asked you "Enable memcache session handler support?"
当安装程序询问您“启用内存缓存会话处理程序支持”时,您是否说“是”?
If it doesn't work, try the new Memcached extension (with the D). It's supposed to be better somehow.
如果它不起作用,请尝试新的 Memcached 扩展(带有 D)。它应该以某种方式更好。
回答by sunghwanyoo
If you want to use memcached
instead of memcache
, make sure you don't have tcp://
in your session.save_path
. So you should fix your session.save_path
from
如果您想使用memcached
代替memcache
,请确保您tcp://
的session.save_path
. 所以你应该修复你session.save_path
的
session.save_path = "tcp://127.0.0.1:11211"
to
到
session.save_path = "127.0.0.1:11211"
回答by Robert de W
You might just still need to install the PHP memcached extension, for example yum install php55-pecl-memcached
例如,您可能仍然需要安装 PHP memcached 扩展 yum install php55-pecl-memcached
回答by NikiC
You will need to enable the memcache session handler support then installing php5-memcache. Which OS are you using and how have you installed it?
您需要启用 memcache 会话处理程序支持,然后安装 php5-memcache。您使用的是哪个操作系统以及您是如何安装它的?