MAMP & PEAR
Putting two and two together.
Upon installation, MAMP already has a great deal of additional packages available to you. Besides the obvious Apache, PHP and MySQL components, MAMP also comes with Freetype, curl and gd pre-installed. The default MAMP installation can also be extended to include other components. PEAR is a distribution system for PHP libraries such as Text_Diff, a simple to use library that compares the difference between different strings. This article will cover the basics of setting up MAMP and installing PEAR libraries.
Installing MAMP
MAMP, like most other Mac applications, can be installed by simply dragging and dropping the application into the Applications folder. Once installed, locate and launch the MAMP.app application1. Then open up the preferences panel and select your desired options2.
Installing PEAR Libraries
To install any PEAR library, download the library of your choice, unzip the downloaded file and copy the contents of the unzipped folder to Applications/MAMP/bin/php5.3/lib/php/ or Applications/MAMP/bin/php5.2/lib/php/. The resulting file structure should be similar to the example below.
- Applications/MAMP/bin/php5.3/lib/php/- Text_Diff-1.1.1/- Diff/- Diff.php- Diff3.php- docs/- test/
Once you have verified the PEAR library is in the correct place, you can start using the library right away. Try the following script and replace the bold text with the folders and files specific to the PEAR library you installed.
<?phpinclude_once('Text_Diff-1.1.1/Diff.php');if (class_exists('Text_Diff')) { echo 'Framework Installed!'; }else { echo 'Error Loading Framework.'; }?>