One of the most important things we do as web developers is test websites. While it’s easy to test static .html pages on your local development machine, it’s not as easy to test dynamic pages without some tweaking first. In this tutorial I will review how to quickly and easily setup a PHP/MySql development environment on your local PC using WAMPSERVER. For this tutorial I will assume that you are conceptually familiar with the fact that PHP is a programming language that is commonly used with the MySql database system, which runs on the Apache web server.
Note that the acronym WAMP (Windows – Apache, MySql, PHP) comes from the parallel acronym LAMP (Linux – Apache, MySql, PHP).
Moving along, in order to get PHP and MySql going on your local development machine you need, in general, three things:
- Apache
- PHP
- MySQL
You may also want to install GUI management software so you don’t have to run MySql from the command line. Installation of this GUI software is completely optional. So let’s add an optional item #4.
4. MySql GUI software such as phpMyAdmin or MySQL GUI Tools. (You can read my review of tools for MySQL GUI access here).
Now that we know what our end goal is, there are two ways to install these three (or four) tools.
1. The first is tedious and is the way I used to do it. First I’d install Apache, then I’d install PHP and configure it to work with Apache, then I’d install MySql and get that running. Lastly I’d install a GUI tool. While this method works well and will teach you a thing or two about installing a development environment, it’s often fraught with difficulty due to version compatibly issues and .ini configurations. Enter WAMPSERVER.
2. You can install WAMPSERVER. WAMPSERVER is a package that will install a fully functional PHP/MySql development environment on your PC. It’s available free for download here.
One of the best features of WAMPSERVER is the ability for you to configure PHP extension and Apache modules with one-click ease, as opposed to having to manually configure .ini files (this feature alone makes WAMPSERVER worth it’s weight in gold).
Another fantastic feature is the ability to run multiple versions of PHP at the same time. Without getting into why you’d need to do this (usually when working with certain PHP frameworks), there are (unfortunate) times where a certain version of PHP is incompatible with what you are working on. Imagine now, having to install an entirely new WAMP configuration just to change the version of PHP. Because everything else you are working on may not be compatible with a different PHP version, you may be asking for trouble by upgrading PHP solely for this one problem application or project. Your only real alternative would be to run a Virtual Machine where you could encapsulate this specific configuration. And while this isn’t really difficult to do, it’s still time consuming – WAMPSERVER, however, makes this “double PHP” situation completely avoidable.
Post Install
One you install WAMPSERVER you will be able to use it immediately. WAMPSERVER will install an icon in the taskbar that will enable you to seamlessly run your server.
In order to actually run .PHP pages or MySql, you will need to make sure that WAMPSERVER is turned “on”. To do so, you will need to head to “Start WAMPSERVER” in your Start Menu (for ease of use, I keep the Start WAMPSERVER shortcut in my quick launch menu).
Because WAMPSERVER automatically installs phpMyAdmin, you don’t necessarily need to install any other MySQL GUI tools. Because phpMyAdmin is great for certain tasks but not others, I also run the free MySql query browser for most of my administration.
I could go on for hours, but now it’s time for you to download and install WAMPSERVER, and see how easy WAMP can be.