Tuesday, March 26, 2013

Installing Memcache on MAMP | Re-Cycled Air


For the better part of 2 hours I tried and failed to get the Memcache extension installed on MAMP.  I tried following several guides, but everything fell flat on it’s face about 75% of the way through.  I eventually figured it out, and I wanted to share it so that other people don’t have to go through the pain and suffering that I did.  It turns out to be surprisingly easy, but YMMV.

Step 1: Install XCode

Step 2: Make the MAMP PHP binary files executable

sudo chmod +xrw /Applications/MAMP/bin/php5.3/bin/p*

Step 3: Get the Memcache extension source

cd ~
wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar -zxvf memcache-2.2.5.tgz
cd memcache-2.2.5

Step 4: PHPize the Memcache extension files

/Applications/MAMP/bin/php5.3/bin/phpize

Step 5: Compile the Memcache extension

./configure
make

Step 6: Add the extension to the PHP.ini file

Add the following to the end of your PHP 5.3 ini file via the MAMP file menu.
extension=memcache.so

Step 7: Copy the memcache extension to the PHP extension folder

cp modules/memcache.so /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-[yourtimestamp]/
The “[yourtimestamp]” varies per installation, but you should just be able to tab complete that part.

PS:
To install memcache on AMPPS, remember the AMPPS PHP is 32-bit so
Instead of the plain make step, try make CFLAGS="-m32".
PPS:
this can be used to install most PHP extensions for AMPPS

2 comments:

Unknown said...

Please tech install memcache for AMPPS on Mac computre.

i try install it ,but not work.

Thank You

ALGO said...

If you know how to use 'make', this article is clear enough