PHP Can't find save handler memcache

爷,独闯天下 提交于 2019-12-14 01:25:02

问题


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.

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:

$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:

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

on OSX 1.6.4 and i put the .so file in the proper directory


回答1:


Memcached, not Memcache. Same as the name of the class.

session.save_handler = memcached

EDIT since the OP indicated that it was just a typo.

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/

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.




回答2:


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

session.save_path = "tcp://127.0.0.1:11211"

to

session.save_path = "127.0.0.1:11211"



回答3:


You might just still need to install the PHP memcached extension, for example yum install php55-pecl-memcached




回答4:


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?



来源:https://stackoverflow.com/questions/4057777/php-cant-find-save-handler-memcache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!