Installing and setting up WAMP is a breeze on Windows, but you are bound to run into issues. I’ve encountered a peculiar one this weekend while trying to run a PHP application I am working on. I had XAMPP already running on my machine, and to avoid having both WAMP and XAMPP lauching by side, i decided to switch all my projects to running on the Apache server provided by WAMP. To do so, i needed to set up a Virtual Host to point to the directory previously holding the projects i had running under XAMPP. I modified my httpd.conf this way:
#Uncommented the line loading the Virtual Host configuration file Include conf/extra/httpd-vhosts.conf
Then in the httpd-vhosts.conf file.
<pre># # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any <VirtualHost> block. # <Directory "C:\Dev\Workspace"> Order Deny,Allow Allow from all AllowOverride all </Directory> <VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot "C:\Dev\Workspace" ServerName localhost.dev </VirtualHost></pre>
With the configuration set up that way, I lost all access to my localhost when starting WAMP. I could access all the projects in the C:\Dev\Workspace folder, but not the ones in the C:\wamp\www standard folder. I could still access phpmyadmin web interface but nothing in the www folder, even a simple html file. Trying to access for example the WAMP index page (www/index.php) would get me:
<h1>Forbidden</h1> You don't have permission to access / on this server.
I tried messing with the settings in the httpd.conf for the DocumentRoot at C:\www\wamp folder to Allow All, minding that this is unsafe on a live web server :
<pre><Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Allow all </Directory></pre>
but got a:
The requested URL / was not found on this server.
error from Apache. A clue about going on to fix this came from commenting out the VirtualHost configuration line again in httpd.conf. That done, I was back in business with my www folder being visible again as well as all the projects within. It seemed that the VirtualHosts configurations were overriding the default Server configuration in httpd.conf. I then added the following code in httpd-vhosts.conf and both my C:\Dev\Workspace and C:\wamp\www folder were again “visible” and I was able to access projects in both locations:
<pre><Directory "C:\Dev\Workspace"> Order Deny,Allow Allow from all AllowOverride all </Directory> <VirtualHost *:80> ServerAdmin email@example.com DocumentRoot "C:\Dev\Workspace" ServerName localhost.dev </VirtualHost> #Added this configuration for the WAMP www folder <VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot "C:\wamp\www" ServerName localhost </VirtualHost></pre>
Hope it helps!