OS X Lion + MAMP 2.0.1 + Memcache and PHP 5.2.17
After a fresh install of Lion, getting up to speed with my normal MAMP dev setup + memcached wasn’t as easy as on Snow Leopard. I ended up seeking inspiration from the following articles:
- Homebrew - for installing memcached
- Lullabot’s article about memcached with mamp
- MAMP Forum - MAMP 2.0.1’s pear is broken
In hindsight, it was quite easy:
- Ensure Xcode is installed - XCode 4.1 is free now in the app store - make sure you install it after it downloads
- Install homebrew as per the instructions here
- Install memcached by simply
brew install memcached
- pear in this version of MAMP is broken, to fix it, simply remove pear’s config file
mv /Applications/MAMP/bin/php/php5.2.17/conf/pear.conf /Applications/MAMP/bin/php/php5.2.17/conf/pear.conf.old
- As per the section ”Install Memcache PHP Extension - Option 2”
- Download the correct version of the php source code for your installed php
- Create the path /Applications/MAMP/bin/php/php5.2.17/include/ and extract the contents of the source code download here.
- Rename the folder that was created as just ‘php’ so you’ll end up with /Applications/MAMP/bin/php/php5.2.17/include/php
cd /Applications/MAMP/bin/php/php5.2.17/include/php ./configure cd /Applications/MAMP/bin/php/php5.2.17/bin ./pecl i memcacheThis should dump memcached.so in the extension folder. If it’s made something other than /Applications/MAMP/bin/php/php5.2.17/lib/php/extensions/no-debug-non-zts-20060613, move it into there (it’d only be different in the last part of the path)
- Add this to the extensions part of your php.ini
- Restart apache
And hey presto, it’s done.
You could also cheat and just put my pre-compiled version of memcache.so in your extension folder and go to town.
I’ve also compiled the php 5.3.6 version of the
.so file. Download it, rename it back to
memcache.so, put it in your extension folder and enjoy.