How to install memcache on Mavericks? (MAMP)

apachehomebrewmampPHP

I have MAMP on my machine, and I would like to install memcache for php, because one of my project throws errors like Fatal error: Class 'Memcache' not found.

I installed X-Code from appstore, and libevent, memcached, libmemcached with homebrew.

Then..

cd /tmp; pecl download memcached
gzip -d < memcached-2.2.0.tgz | tar -xvf -
cd memcached-2.2.0; phpize
./configure; make
sudo make install

Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20100525/

After that I copied memcached.so and memcache.so to my extension_folder:

/Applications/MAMP/bin/php/php5.5.10/lib/php/extensions/no-debug-non-zts-20121212/

and added extension = memcached.so to my php.ini.

I still get fatal error.. what's the problem?

Best Answer

It seems there are 2 memcache extensions. There is memcached and memcache the latter one does not seem to be maintained anymore last stable from 2012.

It looks like your code depends on Memcache since you are using brew, you could just do:

brew install php55-memcache

or

pecl install 

Install brew by issuing:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"