MAMP, which is an acronym for Mac Apache MySQL PHP, is an application which sets up a local Web server development environment in a matter of minutes. It includes support for all of the servers listed as part of its name (support for SQLite is also included).
MAMP provides three basic necessities for any Web application; being a Web server, a database server, and a Web application server – Apache, MySQL, and PHP respectively. Although Apple ships Mac computers with these three servers pre-installed, setup and configuration is not abstracted into a configuration interface as provided by MAMP.
MAMP installation is simple, lets go through the process together.
Navigate to MAMP to find the download links on home page. There are two products available, we will be looking at the standard MAMP install. MAMP Pro offers extended functionality and is available, but you do have to buy a license. MAMP is free of charge and licensed under the GNU general public license. Find the MAMP download button to navigate to the downloads section of site.
Find the download link for the current MAMP version, which is 1.7.2 at the time of this writing.
The MAMP project is hosted on a sourceforge, so you will be redirected. When your download begins, you will be presented with the Download status window, the download should take very little time on a broadband connection.
Go to the directory where your downloaded files are saved, mine is Downloads, located in /Users/myUserName/Downloads, and double click to de-compress the archive (my downloads directory is located in my dock for quick access). An un-archived MAMP installation image will be placed in the same directory as the archived download.
Double click on the MAMP_1.7.2.dmg file to begin the installation. The installer will load and present you with installation instructions.
Within the MAMP window, drag the MAMP folder into the Application folder to install MAMP.
Starting Up MAMP
Using Spotlight, my preference, or Finder, go to the newly installed MAMP folder to find the MAMP launcher. Click on the MAMP application to launch.
MAMP will start and a Web page will open from your localhost confirming that MAMP is installed and default configurations are working.
From the Welcome page, configuration details are available, as well as database management tools for MySQL and SQLite. Additionally, the MAMP Management dialog is open at this point. If you can’t find it, it may be behind your browser window.
The initial screen displays the status of the installed Apache Web Server and MySQL Servers. From this tool all servers may be stopped, the start page that we viewed a moment ago may be launched, preferences may be set for MAMP components, and MAMP may be shut down using the Quit button.
Let’s look into the Preferences dialog.
Inside the Start/Stop preferences we can set the startup options for MAMP as well as set the start page URL, the default is the welcome page, however, this is where we could change to open our development Web site by default instead.
Looking inside the Ports tab:
Here we can set the Apache and MySQL ports. This is nice because we can use the default MAMP Server ports or, if we have other instances of Apache and/or MySQL Servers installed, we can point to them here (i.e. default Apache port might be 80 or default MySQL port might be 3306). We can reset these to MAMP defaults easily using the Reset buttons.
The PHP tab:
Inside the PHP tab, we can select which version of PHP we would like to run our Web application, as well as choosing optimization for Zend, a PHP runtime, and Cache configuration such as eAccelerator which can improve PHP application performance.
Finally, the Apache tab:
Inside the Apache tab we can configure the location of our Web documents. The default location is inside the newly installed MAMP directory’s htdocs folder. This is the location where we place our Web site’s files and run our development site. Once you have placed an index.html or index.php file inside the htdocs folder, you may browse to your local site at http://localhost:8888/mySite.html or http://localhost:8888/mySite.php.
MAMP couldn’t make setting up a local Web server easier, especially with support for PHP, MySQL, and SQLite. Once done with MAMP, if the need to uninstall arises, removal of the application and all files is as easy as sending the MAMP directory to Trash and emptying the bin. All the associated files are located in one place. Warning – if you use the default htdocs folder then your Web application files will also be deleted, so be sure to save your sites to a new location before deleting MAMP.
(By) Douglas Reynolds is an application developer, holds a degree in Software Engineering, and owns an independent Flex application development consulting company. He maintains a personal and technology blog located at dougrdotnet. Find him on Twitter @dougrdotnet and LinkedIn.