HelpSpa.com
Search HelpSpa.com

How to Setup a Local PHP/MySql Test Environment with WAMPSERVER

December 15, 2009DavidMySQL4

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:

  1. Apache
  2. PHP
  3. 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).

wampserver-1

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).

wampserver-2

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.

Tagged , ,

Related Posts

  • Marshall

    Having WAMP problems!!! I just installed WAMPserver, plenty of HD space, Vista Home Premium. I start the admin and it can’t find the localhost. Here’s what I get:

    http://localhost/phpmyadmin/

    Unable to connect

    Firefox can’t establish a connection to the server at localhost. The site could be temporarily unavailable or too busy. Try again in a few
    moments.
    If you are unable to load any pages, check your computer’s network
    connection.
    If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.

    What’s the deal?

    • Did you turn on wampserver first? You need to do that before admin will work.

  • Dan

    Please, can illustrate to me how I can make my php programme run on internet explorer?

    • Could you be a little more specific?

| More

SpiderOak Online Backup, Storage, Access, Sync, and Sharing

We are currently offering a free copy of our 16-page eBook, "How to Organize your Digital Photography Collection" to everyone who signs up for our free newsletter. This eBook will review how to organize your digital photos, discuss metadata, and give you an overview of software than can help you with your digital photography workflow. Sign up in the signup area, located in the right-side column of every page on this site, and read your copy now!


Popular