I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter or add me on Google+.

web developer guide

my books

Book cover of Pro CSS3 AnimationPro CSS3 Animation, Apress, 2013

my other blogs

Massive Head Canon: Intelligent discussion of movies, books, games, and technology.

my projects

A Sass color keyword system for designers. Replaces CSS defaults with improved hues and more memorable, relevant color names.

CSSslidy: an auto-generated #RWD image slider. 3.8K of JS, no JQuery. Drop in images, add a line of CSS. Done.

tipster.ioAutomatically provides local tipping customs and percentages for services anywhere.

Installing A Web Server: Mac OS X

servers / installation

Estimated reading time: 3 minutes

Running PHP on your OS X machine is the simplest option, as almost everything you need is already present: Mac OS X comes with a full Apache server installation that includes PHP. The only downside is that this native installation does not include MySQL. Because of that limitation, this article will provide two options: the first using the native Apache installation, and the second using a downloaded server package that includes MySQL. Note that you will need an Administrator account on your machine to complete both options. Generally speaking I suggest using the second option (MAMP) , as it is easier.

Mac Option 1: Use the native OS X Apache server

Web SharingAs I mentioned, every installation of Mac OS X comes with Apache and PHP: it’s just not turned on. Under System Preferences, go into Sharing and turn on Web Sharing. (Note that you will likely need to unlock the Sharing preference panel in the bottom left corner.)

Sharing Preference PanelThat’s it! You can use the panel’s suggestions as to what the URL of your new, locally hosted server is, or the following:


The question is, where is the page served from?

Go to your home location, and find the Sites folder. Inside this folder you’ll see an index.html page and an images folder: the index.html page is what is being served when you type in http://localhost/

Modified Sites folderObviously we need to improve on this. Create a new folder with the name new-site in the same location as the default index.html page. You will create a new folder in the same location for every site you wish to test. The name of the folder(s) don’t particularly matter, but they should follow web naming conventions.

Now create a new index.html page inside the new-site folder, with some content in the of the page. The URL for the new page is now:


You’re all done! Now you can create a complete site inside the new-site folder, including PHP code, and test it locally. Remember, no-one from the outside world should be able to see this content; it’s just for you.

Mac Option 2: Install MAMP

MAMP InstallationIf you want to use MySQL with Apache, you could try to download components and modify the default Apache installation manually, but I find it much easier to download and install an entire separate server suite. While there are many options out there, I recommend MAMP.

Extract MAMP, double-click on the .dmg image, and drag the MAMP folder icon to the Applications folder. Once it is complete, look inside Applications for the MAMP folder that will have been created for you.

Start the MAMP application. This will start up your default browser to show you that the new server is working, at the following URL:


Default MAMP pageI strongly recommend that you change the MAMP application preferences. Set the Apache Document root to the same location I provided in option 1 above. (When you set the Document Root to a new location, the Apache server will stop and restart, which will take several seconds). Assuming you have the same new-site folder in the Sites folder as in Option 1, the URL to visit the locally hosted site served by MAMP will be:

comments powered by Disqus

This site helps millions of visitors while remaining ad-free. For less than the price of a cup of coffee, you can help pay for bandwidth and server costs while encouraging further articles.