I have finally got around to installing Apache/PHP/MySQL on one of my computers. It’s not that I didn’t want to install A/P/M before, I just never saw the need. I have a VPS server at a great host, and can configure my own php.ini file, and with cable internet access, it’s just as simple to upload and test as it is to test locally. Also, if I’m developing on someone else’s host, I’d rather know how their server operates as I’m developing, not after I’ve completed a site.

However, my grandmother does not have internet access, and I am at her condo every weekend taking care of her. I bring my laptop to work on in the few spare moments I have (it’s not that she’s terribly sick at this point, thank goodness, it’s just I don’t want to be rude). Since it doesn’t look like she’ll be getting internet anytime soon, and I haven’t quite figured out how to hack into anyone else’s network, I decided it was time for local testing.

I used the great tutorials at http://www.ricocheting.com/server/apache.html. For some reason that I cannot recall, it was recommended that I install verson 2.0 (http://www.ricocheting.com/server/apache2.0.html) instead of v2.2, which I did. When I got to step 4, however, which is to open a browser and load either http://127.0.0.1/ or http://localhost/, the browser hung. Nothing loaded. Clearly, I thought I had done something wrong, even though the instructions up to this point were simple and clear. Unfortunately, that great tutorial did not give any hints about what to do if the Apache test page did not show up. Fortunately, I had a PHP/Dreamweaver book with me, and it did: check the log files!

Once I did that, it was a matter of googling my error message to find a solution. It turned out to be not quite as straightforward as I was hoping, so I am putting all the steps to the solution here in the hopes of making someone else’s life easier down the road.

Here’s how to fix an Apache 2.0.x installation on a Windows XP SP2 machine with the same error I had. Open Windows Explorer or My Computer and go to the directory you installed Apache2 into (for example, “C:\Apache2″). Open the folder “logs” and the file “error.log” in Textpad or Notepad. Scroll to the very bottom to see the last error lines. I had the following lines (which were repeated over and over about a thousand times as I kept trying to connect):

[Mon Apr 30 22:18:44 2007] [notice] Child 9692: Child process is running

[Mon Apr 30 22:18:44 2007] [crit] (OS 10022)An invalid argument was supplied. : Child 9692: setup_inherited_listeners(), WSASocket failed to open the inherited socket.

[Mon Apr 30 22:18:45 2007] [error] Parent: child process exited with status 3 -- Aborting.

[Mon Apr 30 22:18:45 2007] [notice] Apache/2.0.59 (Win32) PHP/5.2.1 configured -- resuming normal operations

[Mon Apr 30 22:18:45 2007] [notice] Server built: Jul 27 2006 15:55:03

[Mon Apr 30 22:18:45 2007] [notice] Parent: Created child process 8104

A google search of the “WSASocket failed to open the inherited socket" showed quite a few results that led me to understand that Apache2 would not run on Windows XP SP2 by default. But where was the solution? There seemed to be one, but every link from google linked to the same solution page, which was now a dead page (well, maybe not every link, but it sure seemed like it). Fortunately, someone on a foreign board (Danish, maybe) copied the solution and posted it in English! I’m not even sure how I found this page, or why I scrolled down, but I’m glad I did.

The very simple solution is to uncheck the “Enable LMHOSTS Lookup” box in the TCP/IP protocol setup (under WINS setting). Here are the steps to do this:

  1. Open “Control Panel” then “Network Connections.”
  2. Right-click on “Local Area Connection” and select “Properties.”
  3. Double-click on the “Internet Protocol (TCP/IP)” line to open the “Properties.”
  4. On the “General” tab, click the “Advanced” button.
  5. Select the “WINS” tab and uncheck the “Enable LMHOSTS Lookup” box.”

Now, check the Apache test page at http://localhost/. This time, it should work!