PHP memcached on OSX Lion

Having set up the PHP memcache extension on my mac yesterday I now need the PECL memcached extension to use with Zend_Cache. This one was a little more involved than yesterday so here is a quick list of things you’ll need to do.

My first instinct was to use PECL to get the extension but doing that told me that there was an unmet dependancy so it couldn’t be installed. The missing dependancy was libmemcached, here’s what you need to do to get libmemcached setup:

First go to and download the latest libmemcached (1.0.4 at the time of writing), once downloaded extract the archive and then open up a terminal window and cd to the new libmemcached-1.x.x directory. Now enter the commands below into the terminal window one at a time.

These commands will each take some time to run and while they are running you will see lots of output in the terminal window. What these commands do are ./configure configures the package for your system, make compiles the code into a binary that is usable by the system and sudo make install installs the built files onto your system (which in this case is moving the libmemcached library into place on your system).

Now that we have solved the dependancy issue we can now run PECL again:

At the end of this process the script will remind you to configure PHP to use the new extension, if you are unsure on how to do this you can follow the end of yesterdays post – but dont forget to use memcached instead of memcache.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: