Today I needed the PHP memcache extension on my Mac OSX Lion 10.7.3 development machine for a project I’m working on. I was pleased to find out that this was a nice and easy one to get up and running.
Open up a terminal window and run the command below, this will tell PECL to download, build and install the extension.
sudo pecl install memcache
Now that the extension is installed on your system, you need to enable it in your PHP configuration file. On a standard system the php.ini file can be found at /etc/php.ini. Open the file and scroll down to the extensions section, at the bottom of this section add the line extension=memcache.so and then save and close the file.
After that, all that is required is for you to restart Apache and enjoy your new extension
sudo apachectl restart