Marcus Emmanuel Barnes Rotating Header Image

Using PHP libraries with MAMP

Q: How do I use and install PHP libraries with MAMP?

A: Let’s assume that you want to use the PHP library LIB_http.php (which is used in the examples presented in Webbots, Spiders, and Screen Scrapers: A Guide to Developing Internet Agents with PHP/CURL by Michael Schrenk). Navigate to

/Applications/MAMP/bin/php5/lib/php/extensions/

Copy and paste LIB_http.php into that folder. Then, include the following in your PHP scripts that you run using MAMP:


# Include some_library
include("/Applications/MAMP/bin/php5/lib/php/extensions/some_libary.php");

Here I’ve assumed that you’re using PHP5. You can do something similar if you’re using PHP4. Note that you can place some_library.php into /Applications/MAMP/bin/php5/lib/php/ folder, but I thought I’d keep all PHP libraries I need in the /extensions/ folder to help keep things organized.

Good luck!

P.S. — You might find my copy and paste the full file path to the clipboard finder plugin (created using Automator and a dab of AppleScript) helpful when needing the full path to a local file when programming.

Possibly Related Posts:

2,725 views

Leave a Reply

Security Code: