tyler-morrison
8/27/2015 - 8:07 PM

How To Install Memcache on MAMP 2

How To Install Memcache on MAMP 2

How To Install Memcache on MAMP 2

  1. Install memcached. I'd suggest using homebrew. brew install memcached
  2. Select your desired version of PHP that you'd like to use in MAMP. This dropdown is located in the PHP tab in MAMP PRO.
  3. Visit the Downloads Page on php.net and download the source code. If your release isn't listed, visit the Releases page.
  4. Extract the source into /Applications/MAMP/bin/php/[php version folder]/include/php.
  5. Move to the directory you just created cd /Applications/MAMP/bin/php/[php version folder]/include/php/
  6. Run configuration ./configure
  7. /Applications/MAMP/bin/php/[php version folder]/bin/pecl i memcache.
  8. Add extension=memcache.so to your php.ini within MAMP Pro (CMD + 4)
    • MAMP Pro: /Applications/MAMP\ Pro/MAMP\ PRO.app/Contents/Resources/php[your php version].ini
    • MAMP: /Applications/MAMP/conf/php[your php version].ini
  9. Restart Apache, then :beer:.
  10. Verify memcache is installed correctly by going to http://localhost/MAMP/phpinfo.php and ⌘+F for "memcache".

Also...

Once you have your local binaries properly configured, you can essentially install any other php extension by using that pecl binary. pear, php and phpize should work as well.

Troubleshooting

Make sure pecl compiled the memcache extension to the correct place. It should be in a folder named: /Applications/MAMP/bin/php/[PHP VERSION FOLDER]/lib/php/extensions/no-debug-non-zts-20060613


Inspired by this tutorial, and gisted in case it ever went down.