Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save leonbarrett/5325478 to your computer and use it in GitHub Desktop.

Select an option

Save leonbarrett/5325478 to your computer and use it in GitHub Desktop.
Installing Memcached for MAMP PRO 1.9 running php 5.3.2 on OSX
Step 1 – Install XCode (it’s available from the Mac App Store now).
Step 2 – Make the Mamp php files executable
sudo chmod +xrw /Applications/MAMP/bin/php5.3/bin/p*
Step 3 – Grab the memcached 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 Memcached extension
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
make
sudo cp modules/memcache.so /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/.
Step 6 – Add the extension to the php.ini file
extension=memcache.so
To do this open the MAMP application, go to File > Edit Template > PHP 5.3.2 php.ini
Save the file, stop MAMP and start it back up. Take a look inside your php log to see if there were any errors starting up.
Step 7 – Start Memcached
memcached -d -m 8 -M -p 11211
This starts memcached on the default port and assigns 8MB of RAM.
Step 8 – Check Memcached is running
telnet localhost 11211
stats
Step 9 – Relax, you should be all set up now.
As i’m a it of a CodeIgniter nut, i’ve been using this Memcached library (default settings work out of the box).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment