I had to compile the pecl memcache today for work on my devel system. I already had MAMP installed so I just wanted to do a pecl install ... turns out that won't work. There's a few steps you need to do first. (Note: you must have gcc installed to get this to work. Also, I won't cover installing memcached, just compiling the pecl memcache extension and tying it into php.)
- Using PECL to add to MAMP (OS X)
- First download the right php source from php.net In /Applications/MAMP/bin/php5 create an include directory
- Unzip/tar the php source archive and move it to /Applications/MAMP/bin/php5/include rename the php source directory to just php (so then it will look like /Applications/MAMP/bin/php5/include/php)
- In terminal cd to /Applications/MAMP/bin/php5/include/php and type in ./configure
- Once configure is done running cd back to /Applications/MAMP/bin/php5/bin
- Run ./pecl i packagename (package name is the PECL package you want to install)
- Once the compile is complete cd to /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-########/ (###### is the date)
- Move the extension you just compiled to the first no-debug-non-zts-##### directory. (You should see other extensions in there)
- Edit your php.ini file and add extension=packagename.so where the other extension= lines are.
- Restart your MAMP and then check your php info page to make sure your package is listed as loaded.
