WAMP Server Debugging Tips

,

My brother was having trouble getting WAMP Server running on his machine. This is the process I took him through to get it running. These tips apply equally to XAMPP or any other install of an Apache server on Windows. If you don’t know, WAMP and XAMPP are installers that let you set up a webserver quickly and easily on a Windows machine, usually for testing or whatnot (in this case, to give my brother a sandbox to play in to test out WordPress). These are pretty basic tips — if you’ve set up WAMP before and run virtual hosts and all that, this is probably not worth more than a quick skim. It’s oriented at people struggling with the most common, basic problems (locating document root, making sure port 80 is available and things like that).

First things first. Reboot of your computer after install (not just a standby/hibernate). Though rare, it can happen that the http server can’t access port 80 and therefore can’t start (port 80 is the default for webservers). If you don’t know what that means, that’s fine. Just read on.

So now you’ve rebooted and it’s still not working, so we want to find out whether it’s on the WordPress end or the server end.

  • Can you access a text file through your browser using http (i.e. not opening the file directly, but through the server)? Let’s say you have a readme.txt on your local server. If you go to http://localhost/readme.txt (assuming that exists), will that come up? If that works, than your http server is fine and the issue is with WordPress.
  • If you get a Page Not Found error (also known as a 404), that means the server is running, but it doesn’t have a file named readme.txt in the root directory. If you think it does, you’ll need to figure out which directory WAMP sees as your server root. To figure this out, find out where WAMP is on your computer. Typically, unlike most applicationsm, WAMP installs to C:\wamp, but it could be in your Program Files directory depending on how you installed it. There you want to find your httpd.conf file which is going to be in a location similar to C:\wamp\bin\apache\Apache2.2.11\conf. In the httpd/conf file, look for places where DocumentRoot is set. It will have one global setting and may have additional settings depending on how things are set up (if you have additional virtual hosts set up). The first one should be where localhost runs. So verify that DocumentRoot points to where your files are actually stored. Now try to load the readme.txt file
    again.
  • If that works we can now make sure that PHP is up and running right. Create a file that has just this one line in it:
    <?php phpinfo(); ?>
    Now save that to something like info.php in your server root and just go to http://localhost/info.php. That should bring up a long page of output about your PHP setup. If you are just getting a blank white page when you go somewhere you expect to open a PHP file, that means WAMP is running, but you have either errors or no content in your application. That’s a whole different debugging process.

Assuming you can’t bring up a simple text file.

So you’ve done all that, and things just don’t happen when you try to open http://localhost. I’ve had this happen fairly often because I’ve had Windows (especially Vista) turn on Microsoft’s IIS server after automatic updates. When this happens, IIS grabs port 80, it’s not available for Apache and your web server can’t start. So you run automatic updates and suddenly Apache and WAMP and all that go away. So we need to get rid of IIS and open up port 80.

  • Via the Control Panel
    • Open up Programs and Features
    • Select Turn Windows Features on or off
    • Navigate to IIS (Internet Information Services) and just turn all that junk off. Deselect it all.
    • Restart
  • Via the Services Manager
    • in the Start menu, type Services. This should bring up the Services icon. Click it to open
    • Scroll down to Windows Web Publishing Service and right click and choose properties
    • Change the startup behavior from Automatic to Disabled.
    • reboot

If you’ve rebooted and you still can’t get Apache started, check that something else isn’t blocking port 80. So from the Windows command prompt (go to Run and type cmd) type:

> netstat -aon

then check for a line that has port 80 appended to an IP address, for example:

TCP 255.255.165.21:80 0.0.0.0:0 LISTENING 832

This tells us that Process 832 is using port 80. Go the task Manager to check the PID of 832 and terminate it if it’s not WAMP. Now try to start WAMP. If it does, you have figured out the problem, but you will want to figure out why that process is starting up and whether you can either stop it from launching when you boot or get it to use another port. I’ve found that Skype is common offender and it has a setting in the Skype options to make sure it does not use port 80.

As with any complex application, there is room for all sorts of other things to go wrong, but in practice I’ve found that in most simple cases, this will get you up and running.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>