WAMP Apache Error: “You don’t have permission to access / on this server”

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.

# 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

<VirtualHost *:80>
    ServerAdmin aboukone@aboukone.com
    DocumentRoot "C:\Dev\Workspace"
    ServerName localhost.dev

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:

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

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

<VirtualHost *:80>
    ServerAdmin aboukone@aboukone.com
    DocumentRoot "C:\Dev\Workspace"
    ServerName localhost.dev
#Added this configuration for the WAMP www folder
<VirtualHost *:80>
    ServerAdmin aboukone@aboukone.com
    DocumentRoot "C:\wamp\www"
    ServerName localhost

Hope it helps!

Published by Abou Kone

I am a front end architect with 10+ years of experience in web development. The best part of the process for me is converting ideas into code and solving the technical problems that come along. Alongside providing technical leadership and architectural support to projects spanning multiple industries, I am also experienced in leading discussions with designers, developers, and business stakeholders helping to guide teams in turning complex business workflows or data into easy-to-use web and mobile interfaces. I believe in delivering high quality products and am constantly looking into improving the process and tools use to achieve this goal.

9 thoughts on “WAMP Apache Error: “You don’t have permission to access / on this server”

  1. Thank you so much for such a clear explanation – everything is now working as it should – very painless, thanks for sharing.

    1. sajed to solve this one you need to add the following codes on your httpd.conf file located on C:/your-apache-directory/conf :

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

      Order deny,allow
      Allow from all

      * “c:/php5/” is my php installed location

  2. I had no idea that the includes actually cast an override on the original httpd.conf.
    Thanks for this advice – I didnt’ use the

     tag (since I'm in Linux, you see), but it still worked on my Linux side when I threw that into httpd-vhosts.conf. THANKS <3

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: