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:
You’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:
Windows
Database Name: wordpress
User Name: root
Password: (No Password)
Database Host: localhost
Table Prefix: wp_
Mac
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!



