Vanadium Vanadium

web design

WAMP setup

Leave a Comment

I have been using a Windows computer for development since I first started building websites with Dreamweaver MX back in 2004. When I started using PHP, I needed a web server for testing, so I built up a WAMP server (Windows, Apache, MySQL, and PHP) on my development machine.

There are some good packages that will install all the WAMP components for you, and configure them to work together, but I like to know what’s going on under the hood, so I installed each component separately and configured them myself. Since LAMP is the standard for most production web servers, documentation for configuring a WAMP server is also somewhat scarce. So here is a set of instructions for setting up a WAMP server one component at a time, for people like me, who like to know how things work. It will include the following versions of the software in the stack.

  • Windows 7 Enterprise
  • Apache 2.4.3
  • MySQL Community Server 5.5,28
  • PHP 5.4.7

2013-09-30: There is now a 4 part series that includes more recent versions of the software, and more configuration options, like virtual hosts and SSL.



I am starting with a fresh install of Windows 7 Enterprise (using Windows Virtual PC), and UAC (User Account Control) left on. Other versions of Windows should be similar.


  1. Download the latest version of the Apache HTTP server (currently 2.4.3).
    1. The MSI installer is the easiest way to install Apache, but the latest version that the Apache site links to is 2.2.22, httpd-2.2.22-win32-x86-openssl-0.9.8t.msi, available at Follow the prompts and it will ask you for the necessary information, and install itself as a service on your computer. Then skip to the testing section below.
    2. If you want the latest version, binary installers for version 2.4.3 (for both 32 bit and 64 bit computers), are available from I will be using the 32 bit version,
      1. As noted on the Apache Lounge site, if you don’t already have it installed, you will need to install the Microsoft Visual C++ 2010 SP1 Redistributable Package (x86) from
      2. Download and open and extract the contents of the Apache24 folder to your computer. I like to keep all programs inside my Program Files folder, so I created a folder at C:\Program Files\Apache\Apache 2.4 and extracted the files there (the use of spaces in folder names is just fine).
      3. Open Notepad (you may have to right click it and Run as administrator to be allowed to save the file) and open C:\Program Files\Apache\Apache 2.4\conf\httpd.conf.
        1. Change ServerRoot to “C:/Program Files/Apache/Apache 2.4” (note that it requires Unix style forward slashes, not Windows style back slashes between folders).
        2. Change ServerAdmin to your email address.
        3. Uncomment the ServerName line and change it to your website address.
        4. Change DocumentRoot to “C:/Program Files/Apache/Apache 2.4/htdocs”
        5. Change the relevant <Directory line to “C:/Program Files/Apache/Apache 2.4/htdocs”
        6. Change the ScriptAlias line to “C:/Program Files/Apache/Apache 2.4/htdocs/cgi-bin/”
        7. Change the relevant <Directory line to “C:/Program Files/Apache/Apache 2.4/htdocs/cgi-bin/”
        8. Save your changes.
      4. Open the command prompt, and change to the bin folder with the command CD C:\Program Files\Apache\Apache 2.4\bin
      5. Install Apache as a service with the command httpd.exe -k install. There should be no errors reported there. Also start Apache with the command httpd.exe.
        1. These instructions can be found in the ReadMe.txt file inside the .zip file, and more detailed instructions (including the command for uninstalling the service, httpd.exe -k uninstall) can be found at
  2. Test Apache by opening a browser and browsing to localhost, or If you get the following message, you have successfully installed Apache.
  3. One remaining item that is beneficial is to get the Apache Monitor to run on startup.
    1. In the Start menu, under All Programs, right click the Startup folder, and click Open (or Open all users).
    2. Right click the white space and select New, then Shortcut.
    3. Select ApacheMonitor.exe from the C:\Program Files\Apache\Apache 2.4\bin folder, and finish creating the shortcut.
    4. In the Start menu, find the new shortcut in the Startup folder and click it to start the Apache Monitor. Uncheck Always ask before opening this file, if necessary.
    5. This will show the Apache Monitor icon in the system tray so you can always see if the service is running, and it gives you the option to stop or restart it.


  1. Download the installer for the latest version of the MySQL community server (currently 5.5.28) from and run it.
    1. From the Welcome screen, select Install MySQL Products.
    2. Walk through the next few steps, until you get to Choosing a Setup Type, where I will select Custom, and leave the Installation Path and Data path with their default locations.
    3. From the Feature Selection step, I will unselect MySQL for Excel 1.1.0, under Applications, and the Connector/NET 6.5.4, under MySQL Connectors. I will also unselect the Documentation, since I always use the online documentation. Basically, I like to install the Server, the Workbench, and the Notifier, although only the Server is required.
    4. Continue through the next steps, including the Installation step, until you get to the Configurationstep.
      1. Leave most of the defaults, except check Show Advanced Options, and click Next.
      2. Set a MySQL root password and click Next.
      3. Walk through the next few steps leaving the default settings, until you are finished the installation.
  2. To see if MySQL is running correctly, try out MySQL workbench to see if you can connect to your server with your root password, or just use the Notifier in the next step.
  3. From the Start menu, under All programs, open the MySQL folder, and the MySQL Notifier 1.0.3 folder, and run the MySQL Notifier 1.0.3 program. Like the Apache Monitor, it will show you if your MySQL service is running.

    I would recommend also copying the shortcut to your Startup folder so that it is always available.
  4. In addition to MySQL Workbench, I recommend HeidiSQL or PHPMyAdmin for managing MySQL data, but I won’t explain the installation of those tools here.


  1. Download the the latest version of PHP (currently 5.4.7) from
    1. Download the .zip file for VC9 x86 Thread Safe.
    2. Like Apache, I like to keep PHP inside my Program Files folder, and I like to have separate folders for different versions, so I can switch between them if necessary. Create a folder at C:\Program Files\PHP\5.4.7, and extract the contents of the to this folder (although the install.txt file recommends against it, the use of spaces in folder names is just fine for this server configuration).
  2. This package doesn’t currently have a .dll file that is compatible with Apache 2.4, only 2.3 and older, so you will also need to download the file from
    1. Open the .zip file, and in the PHP 5.4.7 folder find php5apache2_4.dll and extract it to C:\Program Files\PHP.
  3. From the Windows Control Panel, under System and Security, then System, choose Advanced system settings to open the System Properties window.
  4. Switch to the Advanced tab, and click the Environment Variables… button at the bottom.
  5. At the bottom of the Environment Variables window, in the System variables section, scroll down to find the Path variable, and click the Edit… button.
  6. In the Edit System Variable window, edit the Variable value field, adding two new items to the end, both the path to your PHP installation, and the path to the extensions folder of your PHP installation, separated by semicolons.
    ;C:\Program Files\PHP\5.4.7;C:\Program Files\PHP\5.4.7\ext

    1. Click OK to close all these windows.
  7. Open Notepad (again, you may have to right click it and Run as administrator to be allowed to save the file) and open C:\Program Files\PHP\5.4.7\php.ini-production or C:\Program Files\PHP\5.4.7\php.ini-development (I will choose the production version) and Save As… php.ini in the same folder.
  8. Configure Apache to run PHP (these instructions are taken from the install.txt file in your PHP folder, under the following headings: Apache 2.0.x on Microsoft Windows, and Installing as an Apache module).
    1. Open Notepad (Run as administrator) and open C:\Program Files\Apache\Apache 2.4\conf\httpd.conf.
    2. Below the existing #LoadModule lines, add the following lines (again, note the Unix style forward slashes in the path):
      LoadModule php5_module “C:/Program Files/PHP/5.4.7/php5apache2_4.dll”
      AddType application/x-httpd-php .php
      PHPIniDir “C:/Program Files/PHP/5.4.7”
    3. Scroll down to the DirectoryIndex line (inside an <IfModule dir_module> block) and change it from DirectoryIndex index.html to DirectoryIndex index.html index.php. This will make sure index.php pages are served when directory requests are made.
    4. Save the file.
    5. With Notepad still open, create a new file with only one line:
      <?php phpinfo(); ?>
      Save this file as index.php in the C:\Program Files\Apache\Apache 2.4\htdocs folder. We will use this file to test the PHP installation.
    6. Open the Apache Monitor from the system tray, and restart Apache.
    7. The status line at the bottom of the Apache Monitor window should now show PHP/5.4.7.
  9. Test PHP by opening a browser and browsing to localhost/index.php, or If you get the following page, you have successfully installed PHP.
  10. Next we will enable MySQL support in PHP.
    1. Open Notepad (Run as administrator) and open C:\Program Files\PHP\5.4.7\php.ini.
    2. Scroll down to the Paths and Directories section (about a third of the way through the file), and uncomment the extension_dir line, so it looks like this:
      extension_dir = “ext”
      This will tell PHP where to look for extension files.
    3. Next, scroll down to the the Dynamic Extensions section (about half way through the file), and uncomment the following two lines to enable the mysql extension, and the mysqli extension (mysqli is the recommended API to use when for connecting to a MySQL database, the i stands for improved). Delete the semicolon to uncomment the lines.
    4. Save the file, and restart Apache from the system tray.
    5. Open http://localhost/index.php in a browser again, and you should now see two sections that weren’t there before (about halfway through the page), a mysql section, and a mysqli section.
    6. Test your installation by editing your index.php file to something like this, using the “root” account, and the password you selected when installing MySQL:
      $mysqli = new mysqli("localhost","root","password");
          die("Connect error (".$mysqli->connect_errno."): ".$mysqli->connect_error);
      print("Success... ".$mysqli->host_info);
    7. If you see the following page in your browser, you have successfully enabled MySQL support in PHP.
  11. Other recommended configuration changes
    1. There are a few other PHP extensions that are commonly used. To enable them, uncomment the following lines in the Dynamic Extensions section of the php.ini file.
      1. extension=php_curl.dll
        This extension allows PHP to access other websites.
      2. extension=php_gd2.dll
        This extension allows PHP to edit images.
      3. extension=php_exif.dll
        This extension allows PHP to access EXIF data within images.
      4. extension=php_zip.dll
        This extension allows PHP to read and edit .zip files
    2. If you are running this on a development machine, scroll up to the Error handling and logging section, and change error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT to error_reporting = E_ALL, to show all errors.
    3. Change display_errors = Off to display_errors = On, and display_startup_errors = Off to display_startup_errors = On.
    4. Uncomment the error_log = syslog line so that PHP errors can be logged to the Windows Event Viewer (search for “Event Viewer” in the Start menu). Errors will appear under Windows Logs, Application.
    5. Lastly, scroll down to the File Uploads section, and change the upload_max_filesize = 2M to at least 8M, to allow larger file uploads.
    6. Save the file and restart Apache.

Congratulations your WAMP web server is now ready to use.

2013-09-30: See the newer 4 part series to get more recent versions of the software, and information about virtual hosts and SSL.


Comments are closed