MAMP + OAuth + Lion

Aug 12, 2011   #oauth  #MAMP  #LION  #php 

I recently updated my MBP to Lion and decided that while I was upgrading applications, I might as well upgrade my MAMP to version 2.0.1. When installing MAMP 2, make sure to choose the appropriate install. Since this article focuses on Lion, you should just choose the 64 bit version. I had hesitated doing this in the past since there are some unusual steps I had to take in the past to set it up. I had two extensions that I had to make work. The first was OAuth, since it is a key component to the project that I’m currently working on. Fortunately, installation was simple. To make things easier on myself, I added the following to my .bash_profile: export PATH=/Applications/MAMP/bin/php/php5.3.6/bin:$PATH

This ensures that I’m using the correct php, pear, and pecl libraries. After adding that line to my profile, I run the following: $ source ~/.bash_profile which reloads the profile (You can also close the terminal window and reopen it if you really want). Using PECL We’re now prepared to install the PHP OAuth extension. Fortuntately, MAMP includes the PECL library, which means that we don’t have to compile it ourselves. We just have to run through a couple of items before we can do so. First, we need to have the PHP headers so PECL can install against the compiled library. MAMP provides all of the libraries and source code on the downloads page. Just look for a MAMP_components_X.X.dmg link. Once the image has been downloaded, open the image then find and uncompress the php-5.3.6.tar.gz file. By default this will create a folder called php-5.3.6 in ~/Downloads folder. We need to move and rename this folder. I did so via the command line with the following lines: $ cd /Applications/MAMP/bin/php/php5.3.6 $ mkdir include $ mv ~/Downloads/php-5.3.6 include $ cd include $ mv php-5.3.6 php

Now we need to have the header files built for our install. To do this: $ cd /Applications/MAMP/bin/php/php5.3.6/include/php $ ./configure

One last step, otherwise pecl will give us an error: $ rm /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf $ rm ~/.pearrc Installing OAuth With this out of the way, installing OAuth is easy. In fact, it’s just 2 steps. $ pecl install oauth $ echo “extension=oauth.so” >> /Applications/MAMP/bin/php/php5.3.6/conf/php.ini

In part two of this series, I’ll show how to install the Imagemagick extension.