Hackathons/Laptop setup/OSX web server

These instructions assume you are running Mac OS X 10.4, 10.5, 10.6, or 10.7. They've been tested with Mac OS X 10.6, but should work on the other versions, too.jj

Install MAMP to get Apache and PHP
Your account must have Administrator privileges to install MAMP. You can check in System Preferences -> Accounts; "Admin" will be displayed under your user account.

Download MAMP 1.9.6.1 (not 2.1.0) from http://www.mamp.info/en/downloads/index.html. It's about 200 megabytes, so the download will take a few minutes.

Double-click the .zip file to uncompress it, then double-click the .dmg disk image to mount it. Drag the MAMP folder to the Applications folder.

Start Apache
Open the MAMP application (Applications -> MAMP -> MAMP.app). The first time you run MAMP, uncheck the box to "Check for MAMP PRO when starting MAMP" and click "Launch MAMP". MAMP PRO is non-free software that lets you configure MAMP graphically, instead of editing configuration files.

Click Start Servers.

Save a sample PHP file
In this step, we store a simple PHP file in the place where the web server will run it.

Open up a terminal, as you have done before. Change directory into the path used by the web server:

cd /Applications/MAMP/htdocs

We will use the text editor called nano to create a sample PHP file. To start the editor, type this command:

nano -w sample.php

Enter the following text exactly:



Then type Ctrl-o and press enter to save the file. Now, type Ctrl-x to quit.

Finally, load up this URL in your favorite web browser: http://localhost:8888/sample.php. You should see the word "sweet", and nothing else.

If that works, great! If not, raise your hand and get help from a helper.

Clean up (remove) the sample PHP file
Now that we know PHP works, run this command in a terminal to remove the sample file:

rm /Applications/MAMP/htdocs/sample.php

Okay, great. Apache is installed, and we know it can run PHP.

Return to laptop setup
&laquo; Return to laptop setup