Since I did a write-up on setting up a WIMP server, I figured I’d do the same for a WAMP (Windows, Apache, MySQL and PHP) server. In this how-to I will be using Apache 2.2.3 (windows installer) and the latest versions of PHP5 and MySQL 5. I have created a directory on my C drive named ‘web’ (C:\web) where my website(s) files will reside. In this example I used Windows XP Professional running as a virtual machine inside VMWare Server.

Please note, this is what I got working on a test server, and I’m sure it isn’t secure enough for a production environment. This is just the bare bones setup on how I got everything working together so I could test web apps like Moodle and Wordpress. I suggest you try this on a test machine, such as a Virtual Machine, so you don’t make a mistake and kill a working OS. If something breaks, it isn’t my fault.

Download the needed software

  • Download the latest version of Apache for Windows. Apache website
  • Download the PHP binaries zip file (not the Windows Installer version). PHP download page
  • Download MySQL (Windows Essentials (x86), latest version) MySQL download page You can also download the MySQL admin tools if you want to configure MySQL databased via a GUI instead of the command line.

Install Apache

  1. Set the domain and hostname and enter an email address for the server admin. I chose to use the computer’s IP address since it does not have a registered DNS name.
  2. Choose the Typical installation option.
  3. Choose the installation path. I went with the default location.
  4. Click Finish when the installation completes.
  5. Open up a browser and point it to the IP address you specified during setup. In my case, I go to 192.168.1.101 and see the following:
  6. If that works, then Apache is up and running.
  7. You will notice there is now a icon in the Windows taskbar for Apache. Clicking this will bring up a GUI that will allow you to start, stop and restart the Apache server as well as perform other administrative tasks.

Configure Apache

  1. If you haven’t done so already, create a directory to store your website pages. I created a folder named ‘web’ on the C drive (C:\web).
  2. For testing purposes, create an html document and save it to that folder. This is so we can make sure our configurations are taking effect. I created a file named index.html with the following code:



    Hello, welcome to c:\web!

  3. In Apache change DocumentRoot to something shorter, like “C:/web” in the httpd.conf file, located in ‘conf’ folder in you Apache directory. If you choose the default installation path during setup, it would be located at:
    C:\Program Files\Apache Software Foundation\Apache2.2\conf
  4. Change the path for Directory to match the path for DocumentRoot.
  5. Find the DirectoryIndex portion of the Apache config file and add index.php to the list of page names. This will allow Apache to recognize a file named index.php as the default page for a site. You can add other names as needed, such as index.htm.
  6. Save the file and restart Apache.
  7. Open up your browser again and go to the IP address (or whatever you setup) and see if the page we created appears. You may need to refresh the browser for the change to take effect.

Install PHP

  1. Unzip the PHP file you downloaded, and rename it php.
  2. Copy it to a location of your choice. I chose to place it at C:\php
  3. Rename the c:\php\php.ini-dist file to c:\php\php.ini.

Configure PHP and Apache PHP support.

  1. Open the php.ini file and change the line: extension_dir = "./" to extension_dir = "C:\php\ext"
  2. Add the following text to the Apache httpd config file. Place it under the line: AddType application/x-gzip .gz .tgz. If you search for that line it will make life easier.

    Text to add:

    ScriptAlias /php/ "c:/php/"
    AddType application/x-httpd-php .php .php5
    Action application/x-httpd-php "/php/php-cgi.exe"
    SetEnv PHPRC "C:/php"

    Remember to change the above paths to your php folder if it is something other than C:\php.

  3. Also in the Apache httpd file, remove the line ‘Deny from all’ from the first Directory section. You can also comment out the line by placing a ‘#’ in front of it. So after that it would look like this:



    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    #Deny from all
    Satisfy all

    When done save the file and restart Apache.

Test PHP

  1. Create a file named index.php and save it in C:\web (or wherever you chose for your document root) and have it contain the following code:

  2. Open up your browser and go to IPaddress/index.php. If PHP is working, you should see something like the image below.

Installing MySQL

I just downloaded the installer for the latest Windows Essentials version of MySQL (I used 5.0.27) from their site. I ran the install, skipping the registration step, choosing the default settings. In the configuration portion of the setup, I choose Standard Configuration, set MySQL to run as a service, set the root password, and included the bin directory in the Windows path.

After that, I installed the Graphical tools for MySQL, which you can also be downloaded from the website. These tools will allow you to setup databases and users in a GUI instead of the command line console.

Once that is installed you can move on to setting up PHP to work with MySQL.

Configuring PHP to work with MySQL

  1. In php.ini uncomment: extension=php_mysql.dll (remove the ; at the beginning of the line). This allows PHP to see mysql. You can add the line extension=php_mysqli.dll to the list as well as some software will need it to work with PHP5.
  2. Check and make sure that libmysql.dll is in the php directory and that php_mysqli.dll is in the php\ext directory.
  3. Restart Apache

You should now be ready to setup a MySQL database and start setting up your web application.