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

Accepted Answer

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.

Written by kijin
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki