MAMP came out with a new 2.0 version, and so it’s time to update the memcache.so file (see my previous posts for MAMP 1.9.5 and MAMP 1.9.6). As before, you can either download the file, or compile it yourself.
MAMP 2.0 comes with PHP versions 5.2.17 and 5.3.6. I was only able to successfully compile the Memcache extension for PHP 5.3.6, and you can download it directly:
To compile it, you’ll need to have Apple’s Xcode and PECL installed, and you should be able to paste the following commands into Terminal.
pecl download memcache
tar xvfz memcache-2.2.6.tgz && cd memcache-2.2.6
ln -s /Developer/SDKs/MacOSX10.6.sdk/usr/include/ /Applications/MAMP/bin/php/php5.3.6/include
/Applications/MAMP/bin/php/php5.3.6/bin/phpize
MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Applications/MAMP/bin/php/php5.3.6/bin/php-config
make
cp modules/memcache.so /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
rm /Applications/MAMP/bin/php/php5.3.6/include
When finished, don’t forget to edit your php.ini file (File » Edit Template » PHP » PHP 5.3.6 php.ini), adding “extension=memcache.so” next to the other loaded extensions (around line 531).