views:

497

answers:

1

I've pasted the example from php.net for using memcached in php and I'm getting:

Fatal error: Class 'Memcache' not found

I have this in my php.ini:

[memcache]
memcache.hash_strategy = "consistent"
memcache.max_failover_attemps = 100
memcache.allow_failover = 1

Here's info from php -i and php -m respectively:

php -i | grep -i memcache
memcached
memcached support => enabled
libmemcached version => 0.37
Registered save handlers => files user sqlite memcached

php -m | grep -i memcache
memcached

So php seems to have loaded memcached as a module, and php info says that it is loaded and is using v .37. I have not tried yet via apache, I've only been using this through cli right now. Any thoughts?

+2  A: 

There are two extensions for memcached in PHP, "memcache" and "memcached".

It looks like you're trying to use one ("memcache"), but the other is installed ("memcached").

Charles
Thanks Charles. I feel silly now, but I also think it's kinda silly there are two modules for this...
jpfuentes2
It is kind of silly, but it's an unfortunately frequent pattern in PHP. Rather than updating the older extension to work with newer things in better ways, but breaking backwards compt, they simply created a new extension. See also mysql and mysqli.
Charles
and add another one bitten by this.
alexanderpas