This tutorial is for those people who want to start using PHP + MySQL on windows instead of Linux. This tutorial is written entirely from scratch and is based on my personal experience using WAMP. No guarantee is given on the working of WAMP if you make any changes.
The Apache Webserver’s configuration file is named as httpd.conf and is located in the directory C:\wamp\Apache2\conf if WAMP is installed in C:\Wamp directory.
The rules are simple; any line beginning with # is a comment and is simply ignored by Apache while reading its configuration. Line numbers are given for quick reference. They are the default values and can be different is you have changed your settings. Just look out up or down with reference to the line number for what you are searching for. The Apache version used in this tutorial is 2.2.4. For each change to take effect, you have to restart the server
Changing Server Root:
The directory of Apache where Apache is installed and all configuration files is kept. This includes all error and log files. This can be changed by changing them in line 42.
It reads as ServerRoot “c:/wamp/apache2”
You can change this to “c:/Program Fileswamp/apache2” if you had installed WAMP in program files directory. Note the front slashes as opposed to backslashes which is normally used on windows. All paths on Apache contain slashes no matter what is the Operating System.
Making Apache listen to specific IP address or none:
For this just uncomment out the line which reads out like #Listen 184.108.40.206:80 on line 52. If you want Apache to listen to some IP say 220.127.116.11, change 18.104.22.168 with the required IP address. Setting this to 0.0.0.0 blocks all incoming requests.
Making Apache listen on port other than 80:
By default Apache is made to listen on port 80, but sometimes other webservices are also running on the same port which may give rise to ambiguous situations, you can make Apache to listen to any other port other than 80, the best alternative is port 8080, which is the alternate HTTP port, if some other service is running on it then better try out 8180. To change it just change Listen 80 on line 53 with other port no eg Listen 8080 or Listen 8180
Its pretty easy to do so, just uncomment out the # before the LoadModule word. Its starts on line no 67 by default.
The general look for a loaded module looks like
LoadModule modulename_module modules/modulename.so
And that of an unloaded module
#LoadModule modulename_module modules/modulename.so
Changing the root directory of Apache where you keep your scripts:
You are provided with a folder where you have to keep your scripts and execute it via the Webserver. In Linux it is /var/www and /var/www/html in older versions of Apache. In windows it is C:\wamp\www\. This is given in line 150. It is written as
Change C:/wamp/www with any other location like C:/windows/myfolder or any other. Take care of slashes, they are not backslashes.
Configuring you server to be accessed remotely:
Go to line 178, under this are the features for the root directory which Apache accesses. In line 206 change Deny from all to Deny from none and Allow from 127.0.0.1 to Allow from all. You may even try appending a line Satisfy all after the Allow line.
Making your custom error pages:
It’s not much of a headache, just create the page in any file type e.g. html, php etc. Now in line 425 just see the format of adding files. An error code 404 is most famous. It means that the file you requested in not present. Append an extra line to the code and write
ErrorDocument 404 /error404.php
This file should be present in the root directory where Apache is installed. Similarly you can try out other errors by just replacing 404 with any that error’s code.