If you’re a website designer, developer or blogger, the ability to test websites locally can be remarkably useful. It could serve as a testing environment before uploading a new page to your website, or provide a way to work on a website project without an internet connection.
Although OS X comes bundled with a basic web server installed, a more user-friendly solution is available in the form of MAMP. Today we’ll be walking you through the process of setting up a local server with MAMP and outlining the difference between the basic and pro versions.
What is MAMP?
MAMP stands for Mac, Apache, MySQL and PHP. Each of these are the basic elements needed for a functional web server, and MAMP puts them together into an easy-to-use package.
OS X already comes with a basic Apache web server installed, and you’ll be pleased to know that MAMP leaves it completely untouched. No system files are interfered with, and it’s equally easy to uninstall if you find yourself with no use for it.
If you’re planning on creating a site purely with HTML and CSS, there’s no need for a local “web server” as such – just open the file you’ve created in Safari or Firefox. The need for MAMP arises when you need to create a dynamic site with server-side scripting (such as PHP), and a database (in this case, MySQL).
Installation & Setup
After downloading and installing MAMP, you’ll be presented with this simple user interface. Green means that everything is running fine; red means that the server is stopped:
The best starting point after installing MAMP is to click “Open start page”. This will launch your default web browser and take you to the following page:
This page confirms that everything is working correctly, and provides the basic settings required for connecting to your local MySQL database. You can view the phpInfo page for details about the version installed and path settings etc, or directly access a database administration tool (which we’ll come to shortly).
MAMP is also a great solution for running web applications locally. I use it for hosting a copy of Fever, a web based RSS reader, resulting in a far more responsive interface than if accessed over the web.
MAMP is fairly light on the preferences front but a few exist which are certainly worth mentioning. Firstly, you can select whether opening or quitting MAMP will start/stop the server behind it. Deselecting these two options can be useful if you’d like the server to run in the background with any MAMP user interface.
Another setting to be considered is the “Document Root” – where MAMP will look for your website. This can be set to any location on your Mac, and should point to the location of your website files. I have mine set to my “Sites” folder for simplicity, but it can point anywhere.
Accessing your website is then simply a case of typing “http://localhost:8888/” into a web browser.
Managing a MySQL Database
The inclusion of a MySQL (and SQLite) database is very useful, and saves a great deal of setup and configuration that would otherwise be necessary. Two administration interfaces are available: SQLiteManager and phpMyAdmin. Both are excellent tools for managing the content of your database, tables, and records.
Another option to mention (we are a Mac application blog after all) is to use an app such as Querious or Sequel Pro. Both are perfectly capable of interacting with your local MAMP installation, though you’ll need to use the connection settings displayed on the “Start page” to get everything working correctly.
Should you go Pro?
Two different versions of the servers software are available: MAMP, and MAMP PRO. The professional version has a number of additional features which you may find useful (particularly if testing more than one website):
- Virtual Hosts – For managing several sites locally, each with their own web address and folder structure
- Local Mail Server – For sending messages via PHP
- Dynamic DNS – To allow easy external access to your MAMP installation (outside a local network)
- Easier configuration of Apache modules
It also has a more full-featured administration interface:
MAMP PRO costs around $50, but it’s a price worth paying if you feel the additional features may be useful.
If the default Apache installation on OS X isn’t powerful enough for you (and the thought of editing server configuration files makes you shudder), MAMP is a fantastic option. Installation is incredibly simple and you can have a fairly advanced server running in no time at all.
The free release is advanced enough for most casual users, though if you’re looking to test several different domains/websites I would strongly recommend paying $50 for the PRO version.
Do you have any experience with MAMP? I would be interested to know which version you run, and which websites you test locally!