PHP memcached Fatal error: Class 'Memcache' not found

I inserted an example from php.net to use memcached in php, and I get:

Fatal error: Class 'Memcache' not found 

I have this in my php.ini:

[Memcache]
memcache.hash_strategy = "sequentially"
memcache.max_failover_attemps = 100
memcache.allow_failover = 1

Here is the information from php -i and php -m respectively:

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

php -m | grep -i memcache
Memcached

So php seems to have loaded memcached as a module, and the php info says it's loaded and uses v.37. I have not tried it through apache yet, I just used it via Kli right now. Any thoughts?

+75
php memcached
Apr 17 '10 at 16:08
source share
6 answers

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

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

+118
Apr 17 '10 at 16:15
source share

Although the accepted answer says in the comments, the correct way to install Memcache is:

 sudo apt-get install php5-memcache 

NOTE. Memcache & Memcached are two different, albeit related, softwares that are often confused.

EDIT. Since this is now an old post, I thought it was worth mentioning that you should replace php5 with your php version number.

+20
Jun 23 '15 at 18:36
source share

I found a solution in this article: stack overflow

I found working DLL files for PHP 5.4.4

I do not know how stable they are, but they work for sure. Loans go to this link.

http://x32.elijst.nl/php_memcache-5.4-nts-vc9-x86.zip

http://x32.elijst.nl/php_memcache-5.4-vc9-x86.zip

This is version 2.2.5.0, which I noticed after compiling it (for PHP 5.4.4).

Please note that this is not 2.2.6, but works. I also mirrored them on my FTP. Mirror links:

http://mustafabugra.com/resim/php_memcache-5.4-vc9-x86.zip http://mustafabugra.com/resim/php_memcache-5.4-nts-vc9-x86.zip

+1
Jul 22 '13 at 2:30
source share

Right php_memcache.dll . In my case, I used lib compiled with vc9 instead of the vc6 compiler. In apatche error logs, I got something like:

PHP Startup: sqlanywhere: fails Initialization module Module compiled with build ID = API20090626, TS, VC9 PHP compiled with assembly ID = API20090626, TS, VC6 These parameters must correspond

Check if you have one log and try loading another dll compiled with another compiler.

0
Dec 27 '10 at 22:12
source share

For OSX users:

To install Memcached, run the following command:

 brew install memcached 
0
Oct 22 '18 at 1:23
source share

I went into wp-config / and deleted object-cache.php and advanced-cache.php and it worked fine for me.

-5
May 10 '15 at 2:15
source share



All Articles