views:

31

answers:

2

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

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.

kijin
ah sorry I typoed my post, I am using the memcache.so extension, so when I use save_handler = memcached it throws the same error.
Jeff
Thank you for this, I had to run the "pecl install memcache" command to build the extension and enable support. works on my production boxes but unfortunately not for MAMP, I guess i have to figure out a way to recompile the extension for the version I have.
Jeff
A: 

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?

nikic
I followed the instructions here http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environment, using OSX 1.6.4 and i put the .so file in the proper directory
Jeff