Tuesday 29 April 2014

Running WAMP on Windows 8 alongside IIS - 403 Forbidden Index

Problems with WAMP on Windows 8 - Forbidden 403 - Running IIS and Apache side by side

By Strictly-Software

I have just got a new laptop which has come with Windows 8.1.

Thankfully this version of Windows gives me more of  a Windows 7 feel as I really hate those big tablet like buttons. I can't use them as a touch screen anyway and I code not spent all my time on Facebook so they give me no benefit.

I want to get where I am going without Windows telling me how things should look and feel and Windows 8 is numptyfing the user interface even more so that old people can buy their wool with a few swipes but a coder has to hack about for ages to get anything working.

Anyway as I develop in PHP and C#, ASP I need to run both IIS and WAMP side by side on the same PC.

If you have read my earlier article on getting round issues with IIS blocking port 80 you will know that I like to change the port Apache uses to 8888 (a common HTTP alternative) so that I can run both web servers side by side without having to switch IIS off before switching WAMP on and vice versa.

Quick overview is to edit the httpd.conf file and change the listen port from 80 to 8888 e.g

Listen 8888

Also changing the line that mentions the server to:

ServerName localhost: 8888

You can read this article here. Troubleshooting WAMP Server on Windows 7

However with Windows 8 I found this didn't fix the problem and when I tried to access localhost:8888 I would get a Forbidden 403 status error code back when accessing index.php or phpmyadmin.php.

Apparently there are multiple solutions depending on what you want to do with your server.

As Windows 8 is an IPv6 Operating system and WAMP is IPv4 the loopback address is NOT 127.0.0.1 but ::1.

A simple ping to localhost in your command prompt will prove this as you will get back ::1 and not 127.0.0.1.

To fix this problem there are two solutions depending on whether you want to run IIS alongside WAMP. If you don't mind toggling between IIS and WAMP then follow Method 1. If not try Method 2.

Method 1

To get round the differences between WAMP being IPv4 and Windows 8 being IPv6 you need to edit some files.

Instead of changing your httpd.conf file as my previous article does you change the following line.

Listen 80

to

Listen 0.0.0.0:80

Then you would need to edit your hosts file in c:\windows\system32\drivers\etc to comment out the line ::1 localhost e.g:

# localhost name resolution is handled within DNS itself.
127.0.0.1       localhost
# ::1                   localhost

However this doesn't stop the issue of running WAMP alongside IIS.

Therefore if you do want both to run side by side without toggling them on/off ignore what I just said and instead follow method 2.

Method 2

Follow all my steps in the earlier article: Troubleshooting WAMP Server on Windows 7 and then you need to also change the following lines of code in your phpmyadmin.conf file which will be in your c:\wamp\alias\ folder to the following:



<Directory "c:/wamp/apps/phpmyadmin3.5.1/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
 Deny from all
 Allow from all
</Directory>


And then in your C:\wamp\bin\apache\apache2.2.22\conf\httpd.conf file (or whatever version you are using) you need to have these lines of code.

Remove the allow from 127.0.0.1 and replace with allow from all like we did in the previous file.


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>


Now you should be able to access phpmyadmin with either http://localhost:8888/phpmyadmin/ or http://127.0.0.1:8888/phpmyadmin/ and still get your .NET or ASP classic code running with IIS from a simple http://localhost or http://127.0.0.1.

These two methods should sort you out if you get stuck like I did and I am sure when the next version of Windows comes out we will all have some more problems to solve to get WAMP running alongside IIS!

No comments: