- Apache:- http://httpd.apache.org/download.cgi (download the latest stable release. You need the latest win32-x86-no_ssl.msi package. My file was named httpd-2.2.15-win32-x86-no_ssl.msi)
- MySQL:- http://dev.mysql.com/downloads/mysql/ (download the appropriate MySQL MSI installer. Even the essentials one is fine)
- PHP:- http://php.net/downloads.php (download the php installer from the windows binaries section. Do not download the zip package)
Once you have the required setup files, all you need is start installing!
- Start with the installation and follow the instructions. When you reach the “Server Information” dialog, you can use the following settings there:
- 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).
- 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.
- Run the MySQL installer and choose Typical installation and proceed.
- Once installation is complete and you are on the Wizard Completed window, make sure you have the checkboxes as indicated below:
- Upon clicking Finish, the MySQL Server Instance Configuration Wizard window will open.
- Select Standard Configuration when asked for as shown:
- 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.
- 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.
- Once finished, open cmd (Command Prompt) and type in the following to go to the MySQL prompt:
mysql -u root -p
- Launch the installation wizard. When you reach the Destination Folder window, choose “C:\PHP”.
- In the next window, you have to select your web server setup. Choose Apache 2.2.x Module and click next.
- 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\
- 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)
- Click Next and begin the installation. Everything will be done automatically!
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:
- 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.
- 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.