I assume you have Apple developer tools (Xcode) installed already because we need GNU Compiler Collection (gcc) (that is integrated to Xcode installation) according to complete the following process. Also I assume you installed MAMP 1.9.x with PHP 5.3.x
Lets follow these steps:
Step 1: Need to Download the PHP source of version same as of your MAMP’s PHP and configure it. For these, open the terminal and run the following commands:
$ cd Downloads $ tar xvf php-5.3.5.tar $ mkdir -p /Applications/MAMP/bin/php5.3/include $ mv php-5.3.5 /Applications/MAMP/bin/php5.3/include/php $ cd /Applications/MAMP/bin/php5.3/include/php $ ./configure
Step 2: Now need to Download the latest stable version of memcache and then configure it. I assume you are in the /Downloads/ directory now on terminal. Then run the following commands:
$ tar xzf memcache-2.2.6.tgz $ cd memcache-2.2.6 $ /Applications/MAMP/bin/php5.3/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/php5.3/bin/php-config
Step 3: Lets make and install memcache by running the following commands. I assume you are in the /memcache-2.2.6/ directory on terminal.
$ make $ sudo make install
Step 4: Add this new extension on php.ini file. That file can be found here /Applications/MAMP/conf/php5.3/php.ini
Edit the file by adding the following line
Step 5: Restart the Apache server.