Memcache vs Memcached -> Class 'Memcache' not found

Hi,

I want to use memcacheD as backend, unfortunately if I try I get a fatal error "Class 'Memcache' not found..." I use the memcached extension not memcache, ist this the problem?

If I use the file backend all works fine, so I think it's not an autoload issue.

Best, Thorsten



5.2k

Yup, have been bit by the same issue. Reported previously @ http://forum.phalconphp.com/discussion/287/fatal-error-class-memcache-not-found

Would be good to see support for memcache in the next version.

You mean memcached!?

There are two different, and distinct extensions for PHP, the older memcache, and a newer memcached extension. Even though they perform the same primary function - connect to a memcached instance somewhere - they are not interchangeable! They use different PHP function calls. Phalcon currently uses the more prevalent memcache extension and it's functions. If you have only installed the memcached extension and libmemcached, the Memcache classes will not function!

We all need to be VERY careful with what we call classes and the like. For instance, there is a class in the incubator that is called Phalcon/Cache/ Backend/Memcached.php, but then uses

use Memcache as NativeMemcache;

$this->_memcache = new NativeMemcache;

This is NOT using the memcached extension with libmemcached as one would assume by the name.

If you do a Google search, you will see that memcached is the newer, faster extension that implements more of the libmemcached protocols. It WOULD be nice if the memcached extension was supported in the C code. You can write your own of course by extending the appropriate classes, but having it in user-land defeats the purpose of a compiled framework yes? :-)



5.2k

Bump

Hope this gets traction.

So whats the outcome of this? I am still getting Fatal Error: class 'memcache' not found I cant even seem to get Memcache to work correctly



1.7k
edited Aug '14

I am working on two machines, one local, one remote - and it turns out I forgot to install memcache extension on my local machine.

So whats the outcome of this? I am still getting Fatal Error: class 'memcache' not found I cant even seem to get Memcache to work correctly I know this is old but show your DI settings. This issually where the clue to this error is