How to Set Up a Local PHP/MySQL Development Sandbox for Windows and OS X

How to Set Up a Local PHP/MySQL Development Sandbox for Windows and OS X

Editor’s Note: This is the first guest tutorial that we’ve decided to post on Build Internet since our launch. In this post Dixon has put together a visual guide to setting up a local development environment for testing PHP/MySQL driven websites. We’re excited to hear your feedback in the comments! – Zach

The Goal

By the end of this tutorial, we will have a fully working copy of WordPress running from our local machine. We will accomplish this using an all-in-one package either called WAMP (for Windows) or MAMP (for Mac). WAMP/MAMP is an abbreviation of Windows/Mac – Apache – MySQL – PHP. As you could have guessed, this will get Apache Web Server, MySQL, and PHP up and running in one-click.

Why Test Locally?

To test, test, test! There is no payment from a client if the site you made for them goes down within 24 hours. That’s why you need to test all the aspects out before you push it live.

The first part of the tutorial will vary between operating systems, please find your own and follow along!

The Guide for Windows

Follow this link to find the WampServer download page and download the program. Run the installer once it completes. You will come to the following page:


You could specify a custom folder for WAMP to be installed but for the purposes of this tutorial, we will be using the default.

The next prompt will ask you to specify your default browser:


The default is Internet Explorer, but you could specify another browser as needed.

Next, you will come to a page asking about your SMTP settings if you will be using the PHP mail() function. As we are not going to be using this feature for this tutorial, just leave the defaults.

Hit finish and WampServer 2 will launch! Verify that everything is working correctly by launching your web browser and typing “localhost” into the address bar. You should see the following:

wamp_install_4You’ll also notice that a WAMP icon now appears in bottom task bar. This is a quick way to manage server functions from the desktop.


The Guide for Mac OS X

Mac users, we haven’t forgotten about you. Your testing environment will be from a wonderful little program called “MAMP”.

Download a MAMP installer from the official project website. It’s a little bit heavier of an install at 140 MB (compared to WAMP’s 16MB) Extract the DMG and drag the application to your Applications folder.


Run the Application and click on Preferences. Leave the settings as is under Start/Stop, make sure your Apache Port is 80 and your MySQL Port is 3306. Under PHP, you could use PHP 4 but for this tutorial we will be using PHP 5. Then, under Apache, you can set your document root to whatever you like.

That’s it! Start up your servers then browse to http://localhost/MAMP/ in your browser. If it’s running correctly you should see something like the following:


Let’s install WordPress!

Go ahead and download the latest version of WordPress. (Version 2.7.1 at time of publishing) Extract the file and open up the folder.

Copy all the files into ‘YourDocumentRoot/wp/’. For Windows, your document root should be ‘C:/wamp/www/’. For Mac, your document root should be ‘/Applications/MAMP/htdocs/’.

Next we have to create a database for the WordPress install to use. We will use phpMyAdmin to do this.

  • On Windows browse to http://localhost/, then click on PhpMyAdmin towards the end of the page.
  • On Mac browse to http://localhost/phpMyAdmin/ to go straight there.

Once you’re in phpMyAdmin, you should see a page like this:

Type ‘wordpress’ in the box and hit Create to create a new database.

Browse to where your WordPress files are located (which should be http://localhost/wp/) Since we didn’t create our own wp-config.php file, WordPress will create one for us.


Next, you’ll come to the configuration form:


What you enter will differ slightly whether you are on Windows or Mac, so here’s the info:

Database Name: wordpress
User Name: root
Password: (No Password)
Database Host: localhost
Table Prefix: wp_

Database Name: wordpress
User Name: root
Password: root
Database Host: localhost
Table Prefix: wp_

Once you enter your information correctly, you’ll be taken to the final install page:


Click “Run the Install” and then you’ll be asked for some basic information about your blog: (You can always change this later)


After you provide that basic information, you will be given your temporary password to login to your blog. Note this password carefully! If you forget it, you’ll have to reinstall!

And finally, you’ll find yourself at a log in page. Use your new account to access your fresh new local WordPress install!


That’s it! Go have fun with your web sandbox!

Posted Saturday, May 16th, 2009 · Back to Top


Add Comment

23 Comments 20 Mentions

  1. Ractoon Author Editor

    Local development definitely helps with efficiency. Don’t have to worry about network connection issues, and you’ll automatically have a backup once you migrate your files to the production server.

    Though I prefer to use XAMPP – – cross platform with a variety of features.


  2. Joël Cox Author Editor

    OS X comes with Apache pre-installed, but isn’t configured in the way it should be. You can simply change the HTTPdocs root, download and install a MySQL package. Change the database socket in your Apache config and you’re ready to go.

    If you don’t fancy using a command line, these programs (and XAMPP) are great alternatives, but I just hate to have two similar programs installed on my system :D

    Joël Cox’s last blog post..Review: De wet op internet


  3. mkjones Author Editor

    Yep XAMPP – – is a FAR better resource for this. No need to install and you can run it from a memory stick.

    Always handy when freelancing.


  4. IntensiveSoft Author Editor

    Think xampp is the better alternative, but there are some stuff that i dont like in the bundle. For that reason I still use easyphp as testing server.


  5. Zach Dunn Author Editor

    I have a question for the crowd after reading some of the comments recommending XAMPP:

    What is a selling point of XAMPP over using MAMP (my current choice) if you always develop on the same machine, and being portable isn’t really necessary?

    From my experience MAMP is absolutely wonderful, and does everything I’d expect it to. If XAMPP has some big advantages that I’m missing out on, please share!


  6. Sean O Author Editor

    Many of these packages work pretty well, but I think MoWes is the best of the bunch.
    Most major packages: WordPress, Drupal, Moodle, etc. are available to download, pre-installed.

    Sean O’s last blog post..Bubble Spinner


  7. Guillaume Moigneu Author Editor

    The problem with MAMP is that everything is hidden. Editing php config is a real pain and it is hard to use the cli executable.

    My current choice of sandbox is a debian configured as a LAMP platform running on VMWare with an AppleShare folder.

    Guillaume Moigneu’s last blog post..[Symfony] Générer les fixtures à partir de la DB


  8. Dixon Crews Author Editor

    Seems MAMP isn’t the preferred article amongst you guys. Well, I like it. :P


  9. Viking Beard Author Editor

    Thank you so much! Apache and phpMyAdmin was completely bizarre to me before this tutorial. I appreciate having the screencaps included!


  10. Marty Thornley Author Editor


    Great tutorial for a subject I don’t see mentioned enough. And Zach – this was a great choice for a first guest post. MAMP is a huge benefit for anyone developing WordPress themes and a set-up like this should be getting more attention than it does.

    I have used MAMP for a while now and love it. There may be some advanced PHP things you can’t get at, but I wouldn’t know. I have used it out of the box to set-up and build WordPress sites no problem.

    MAMP speeds up development of a new site and makes you realize just how much time you spend waiting for a page to refresh just to test a quick change. I can’t imagine going back.


    Marty Thornley’s last blog post..WPJumpStart – Build WordPress Themes Faster


  11. michelle Author Editor

    Thanks heaps! I couldn’t get my local WordPress sites running after transferring them over from a Windows machine running XAMPP. I figured out that Mac needed the password for the database to be set but still couldn’t get them running. Changing the default Apache and mySQL ports was all that was necessary!

    Thanks again!


  12. Sayz Author Editor

    I use XAMPP, it was the first time I got Mac OSX and search Google. It works well, except I don’t really understand how it works…


  13. Ace Newman Author Editor

    XAMPP is the very best. It’s cross-platform, and also packs Perl with it. Way to go!


  14. AmyHewitt Author Editor

    Great tutorial, interesting and informative.


  15. Georgie Author Editor

    Really great tutorial – thank you so much. Exactly what I need to learn, very clear, incredibly helpful!


  16. Patrick Author Editor

    Why using MAMP? OS X comes with Apache and PHP “onBoard”, just install a MySQL and you’re fine.


  17. Dixon Crews Author Editor

    Yes, it does, but I find it much easier to configure MAMP and get it running.
    .-= Dixon Crews´s last blog ..dixoncrews: Got the MBP back…all shiny and new screen :) =-.


  18. Mr.Nguyen Author Editor

    Great tutorial, i like it,thanks for share


  19. SM Author Editor

    Nice post. Thanks


  20. timtam Author Editor

    Thanks a tonne for showing me WAMP. Before, i’d tried XAMPP and it kept screwing up, so i kinda gave up :P
    I stumbled across this and it was so easy to set up :)

    Cheers again :D


  21. Giles Author Editor

    Thanks so much for this, without this I wouldnt have had a clue. Keep going guys I love it.



  22. RAHUL Author Editor

    Thanks for this tutorial it is really helpful


  23. santiago Author Editor

    Thanks for the tutorial! really helpful! (even tough some things have been updated).



Build Internet by One Mighty Roar. Since 2008.