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!


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

  1. saved my day :PP thx

    1. hey, don’t mention it! Those little errors can be big time wasters!

  2. Awesome. This saved my day as well!

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

  4. hi
    i am iran
    i do not understand this error
    you don’t have permission to access /php/ php-cgi.exe/index.php on this server.
    please help me

    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

  5. perfect helped me a lot thank u

  6. 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
  7. […] strong>You don’t have permission to access / on this server – solution […]

Leave a Reply to sajed Cancel 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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: