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?
How to install memcache and memcached on any version MAMP and on any version of php on LINUX/MAC by yourself?
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install memcached
brew install libmemcached
start memchached (daemon) as you whish To have launchd start memcached at login:
ln -sfv /usr/local/opt/memcached/*.plist ~/Library/LaunchAgents
Then to load memcached now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.memcached.plist
Or, if you don't want/need launchctl, you can just run:
/usr/local/opt/memcached/bin/memcached
/Applications/MAMP/bin/php/[PHP VERSION YOU USE!!!]/lib/php/extensions/no-debug-non-zts-20060613
add to php.ini (the same version you downloaded and using with mamp) this line: extension=memcache.so;
phpinfo(); and check memcached appears.
OK ITS DONE !!! NOW -> have a beer :)