Saturday 31 December 2011

Troubleshooting WAMP Server Installation on Windows 7 machines

Troubleshooting WAMP Server installation on Windows 7 computers

I like to code in both PHP and .NET or ASP so on my laptop or PC I need to be able to run
both PHP code and .NET code.

As both languages use different web servers to run their code this means on Windows PC's I have been installing WAMP Server to run and test any PHP code. However ever since moving to a new laptop (Windows 7 64 bit) I found that getting WAMP Server to work was a right pain in the arse.

I had managed it on my Work PC (also Windows 7 64 bit) without any problems at all so I don't know why on a fresh install I had issues. Anyhow this is how I troubleshooted WAMP Server installation on a Windows 7 laptop.

After installing wampserver turn it on and start all service then try and access it e.g http://localhost

You will probably be met with an IIS 7 home screen and not the WAMP Server home screen you might have expected.

This is because windows PC's come with their own IIS web server which sits on the same port 80 that WAMP Server does.

First off try turning off IIS by going into Administrator Tools, open IIS and disable it.

Or you could go into Administrator Tools, open Services and turn off World Wide Web Service.

Then restart all the WAMP Server services and try http://localhost or again

If it works then you will be met with the WAMP Server Home page but if like me on Windows 7 you might be met with a 404 page that just says

Not Found

HTTP Error 404. The requested resource is not found.

So WAMP is still not running even though the other web server running on that port is off. So something else is blocking or listening that port.

You can try to find out what this is by doing the following:

Running Command Prompt (under administrator rights)

Typing in: netstat -b -o

You need the -o so that you can see the Process ID column as long as you remembered to run under admin privileges and you need the -b to see which program is running or creating the connection consuming the listening port in this case port 80 on (localhost).

You will get something back like this

C:\windows\system32>netstat -b -o

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP           my_pc_name:49719       TIME_WAIT       0
  TCP           my_pc_name:49721       TIME_WAIT       0
  TCP           my_pc_name:49723       TIME_WAIT       0
  TCP           my_pc_name:49725       TIME_WAIT       0
  TCP           my_pc_name:49727       TIME_WAIT       0
  TCP           my_pc_name:49729       TIME_WAIT       0
  TCP           my_pc_name:49731       TIME_WAIT       0
  TCP           my_pc_name:49733       TIME_WAIT       0
  TCP         my_pc_name:49718       TIME_WAIT       0
  TCP         my_pc_name:49720       TIME_WAIT       0
  TCP         my_pc_name:49722       TIME_WAIT       0
  TCP         my_pc_name:49724       TIME_WAIT       0
  TCP         my_pc_name:49726       TIME_WAIT       0
  TCP         my_pc_name:49728       TIME_WAIT       0
  TCP         my_pc_name:49730       TIME_WAIT       0
  TCP         my_pc_name:49732       TIME_WAIT       0
  TCP         my_pc_name:49155       ESTABLISHED     1368
  TCP        my_pc_name:49441       ESTABLISHED     1128
  TCP        my_pc_name:5354        ESTABLISHED     1128
  TCP        my_pc_name:27015       ESTABLISHED     4768
  TCP      ww-in-f125:5222        ESTABLISHED     4884

Not very helpful as all the Proccess ID's for port 80 on are set to 0.

If it's not set to 0 you can find out what process is listening on it by going to your Task Manager, ticking the "Show processes from all users" box and then searching for the PID (process ID).

If the PID column is not shown then go to View > Select Columns and tick the PID (Process Identifier)

So because we are no nearer to working out what is using this port we are stuck as the other web server is disabled and not listening on port 80 but it seems nothing else is. A virus scan with a good tool helps here just in case something is running that shouldn't be.

As I haven't been able to find out what is using the port I have to now resort to a hack to get WAMP Server running.

This hack is actually useful if you want to be able to run WAMP and IIS on the same machine at the same time.

If you have done a default install then go to the httpd.conf ini file which should be at:


Then find the Listen option which will be under some comments near the top starting with

# Listen: Allows you to bind Apache to specific IP addresses

and change it to a port you want to use instead of 80 and one you know you are not using. I chose port 8888 a common HTTP alternative port.

So add this line in under the comments.

Listen 8888

This should get your WAMP Server default page up after a WAMP restart by accessing:


However you should also change another directive in the file which identifies the servers name.

It starts with these comments

# ServerName gives the name and port that the server uses to identify itself.

So replace

ServerName localhost


ServerName localhost:8888

or if you chose a different port then use that instead of 8888.

You will now find that you can access WAMP Server from your PC okay and if you still want IIS to run alongside then it's a good idea to change the PORT of WAMP Server anyway to prevent having to keep turning IIS off (or permanently disabling it).

A bit of a pain to get going but it works for my 64 bit Windows 7 PC and I know someone else who had the same problem with their new PC. On my older XP laptops and PC's I had no problems at all getting WAMP working and it's only since moving to Windows 7 I have had this issue.

If anyone know what causes this issue then please let me know but please don't reply SKYPE or some other application could be the problem as we ruled that out with the netstat -p -o command prompt scan earlier.

Anyway this hack gets WAMP Server running and it is good to know how to debug the problem.


Anonymous said...

Right! Making PHP run under Windows is a real pain compared to the effort needed to set it up on Linux. Although I'm an experienced Windows sysadmin it took quite a bit to get Drupal running on W2k3. The same installation on Linux is incredibily fast and easy to accomplish (and I'm not a Linux guru!).

Nice article.


BlackberryBeat Admin said...

Awesome bro, now this worked for me, Just went with port number 8888 and it worked.

Many thanks!

Rob Reid said...

Glad to hear - donations would be much appreciated it if it saved you time or money - they are located on every blog posting!

Rob Reid said...

Glad to hear.

If it saved you time or money then donations would be much appreciated.

They are on every post at the bottom or on

Or just use your click button on your mouse in the right place ;)

Dhiraj said...

thank you it is work for me to change the port for wampserver

Anonymous said...

this post actually helped to figure out the problem. thanks a bunch.