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 2: Make the MAMP PHP binary files executable
sudo chmod +xrw /Applications/MAMP/bin/php5.3/bin/p* |
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 |
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 |
/Applications/MAMP/bin/php5.3/bin/phpize
Step 5: Compile the Memcache extension
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.
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]/ |
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.
7 replies on “Installing Memcache on MAMP”
[…] on it’s face about 75% of the way through. I eventually figured it out, and I wanted to… [full post] Jack Slingerland Re-Cycled Air php programmingmampmemcachephp 0 0 […]
Thanks, nice how-to.
[…] as an exercise for you. Once that’s installed, you should check out my guide for getting the PHP Memcache module installed on XAMPP, that way you can run this tutorial […]
[…] as an exercise for you. Once that’s installed, you should check out my guide for getting the PHP Memcache module installed on XAMPP, that way you can run this tutorial […]
As an update to Jack’s great tutorial on installing memcache, when I followed his instructions, everything was compiling and configured successfully, but for the life of me, I could not get MAMP to see the module. I had a suspicion that the memcache.so file was compiled for 32-bit or 64-bit and MAMP wasn’t loading the extension correctly.
if you run into this problem, in Step 5, replace the ./configure line with:
CFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -g -Os’ LDFLAGS=’-O3 -arch i386 -arch x86_64′ CXXFLAGS=’-O3 -fno-common -arch i386 -arch x86_64 -g -Os’ ./configure –disable-dependancy-tracking –disable-shared -enable-static
… Then continue on with the steps and memcache will install against MAMP Pro / PHP 5.3 successfully.
Source: http://blog.elinkmedia.net.au/2010/11/02/enable-memcache-on-mamp/
Thanks for a great article. Why did you go with compiling from source rather than using PECL? Here’s an up-to-date guide I wrote that uses PECL+Homebrew:
http://www.silviogutierrez.com/blog/drupal-6-and-memcached-mamp/
Thanks for the brilliant tut! I’ve followed it exactly but I get the following error when starting MAMP.
PHP Warning: PHP Startup: memcache: Unable to initialize module
Module compiled with module API=20100525
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
I am running MAMP Pro v3 with PHP 5.5.10. Any ideas?