My space in the world

Code is poetry

Posted by Sayak
May - 26 - 2010

With this guide, I’m trying to simplify the setting up of a WAMP stack on your computer. To begin with, you’ll need the appropriate setup files:

Once you have the required setup files, all you need is start installing!

Installing Apache

  1. Start with the installation and follow the instructions. When you reach the “Server Information” dialog, you can use the following settings there:
    
    
    Apache Server Settings

    Apache Server Settings

  2. Once finished, you will see the icon in your system tray. You may otherwise see the icon, which means that “Monitor Apache Servers” is running, but Apache2 isn’t started.
    You can easily start/stop/restart Apache and Apache2 via that icon in your System Tray. If you get “The requested operation has failed!” error while starting apache use the “Test Configuration” shortcut in the Start Menu to find the error (if the text window pops up then closes before you can read it, your config file is fine).
  3. Now to check if apache is running. Normally, apache should start listening to port 80. In some cases, it might bind to port 8080 instead.
    Open your browser and visit http://localhost/ or http://localhost:8080/
    If it shows the It works! you have your server software installed and running. If it doesn’t, you may log on to http://webchat.freenode.net and join #httpd to ask your queries.
    We will be configuring apache later in this tutorial.


Installing MySQL

  1. Run the MySQL installer and choose Typical installation and proceed.
  2. Once installation is complete and you are on the Wizard Completed window, make sure you have the checkboxes as indicated below:

    MySQL setup

    MySQL setup

  3. Upon clicking Finish, the MySQL Server Instance Configuration Wizard window will open.
  4. Select Standard Configuration when asked for as shown:

    MySQL configuration

    MySQL configuration

  5. In the next window, make sure to:
    a. Check the Install as Windows Service checkbox. Service name should me MySQL. You may also want to check Launch MySQL server automatically checkbox.
    b. Check the Include Bin Directory in Windows PATH checkbox as well. Click on Next button.

    MySQL configuration

    MySQL configuration

  6. In the next window, enter and confirm a root password. Write this down somewhere as you might need it later. I recommend to keep Enable root access from remote machines unchecked. Also, Create an anonymous account checkbox should be kept unchecked. Click on Next and then Execute buttons.
  7. Once finished, open cmd (Command Prompt) and type in the following to go to the MySQL prompt:
mysql -u root -p

Installing PHP

  1. Launch the installation wizard. When you reach the Destination Folder window, choose “C:\PHP”.
  2. In the next window, you have to select your web server setup. Choose Apache 2.2.x Module and click next.
  3. In the Apache configuration directory window, browse to the folder where httpd.conf file is stored. For me, it is in C:\Program Files\Apache Software Foundation\Apache2.2\conf\
  4. In the Choose items to install window, select the following:
    a. Script executables
    b. GD2, MySQL and MySQLi (you can find these after expanding Extensions)
  5. Click Next and begin the installation. Everything will be done automatically!

Configuring Apache

Now all you are left with the configuration part. Open the httpd.conf files usually located inside Program Files\Apache Software Foundation\Apache2.2\conf\
Windows Vista/7 users make sure you open your text editor with administrator privileges before doing that. You can open notepad (or any other text editor by right clicking on it’s start menu entry and selecting Run as Administrator
).
Once you’ve opened httpd.conf, make the following changes:

  1. You can make apache point to your own folder. To do that, search for DocumentRoot and change it from the default htdocs folder to whatever of your choice. You also need to make another change.. scroll down or search for <Directory> tags. You’ll need to change the directory tag with the htdocs path to the same one you specified above.
  2. Remember, I said that apache may bind to 8080 in some cases. If your localhost opens only when you specify localhost:8080 try searching for the Listen directive in httpd.conf and change the port number to 80.

Finally, click on the apache icon in the system tray and restart apache.

That’s all! Get a beer, sit back and enjoy! :)

If you face any configuration issues, feel free to ask here.

7 Responses to “Installing PHP – Apache – MySQL on Windows”

  1. Techwatch says:

    Great guide to the tricks of the setting up of a WAMP, thanks

  2. Nigel says:

    Why not use XAMPP instead?

    • Sayak says:

      Debugging issues, rewrite engine doesn’t work well, and it gets more and more proprietary. At least with WAMP, you have the situation under control..

  3. David says:

    Your guide is a life saver! Thank you so much.

  4. KxYy says:

    You didn’t miss the smallest thing.. I dugg your submission :)

  5. Pronoy Chopra says:

    ZOMG ! this is how awesome projects are developed. ZOMG ! this is too much awesomeness
    So I think I’ll use Ubuntu instead.

    • Sayak says:

      It’s a tutorial, not a “you must use this” article. Keep it or trash it.
      And of course, you are free to use anything you want. I couldn’t care less ;)

Leave a Reply

About Me

A son, brother and friend. Enjoys scripting and making small bits of apps here and there. Wants to conquer the world (well, who doesnt). A geek who has an obsession for ponies. Loves acoustic and wants to play guitar sitting on the Hollywood hill one day!

A Word About KDE

KDE is a versatile software compilation for all platforms. It is an intuitive and powerful desktop environment that focuses on finding innovative solutions to old and new problems, and creating a vibrant, open atmosphere for experimentation.

» http://www.kde.org