Adventures In Wonderland

“A slow sort of country!” said the Queen. “Now, HERE, you see, it takes all the running YOU can do, to keep in the same place. If you want to get somewhere else, you must run at least twice as fast as that!” – Through the Looking Glass

An Unfinished Project

My laptop was languishing. I had purchased it to use at work, but it never arrived at my temporary cubicle in one of the IT buildings at Boeing Bellevue…

I had been surprised to be offered the job. It happened, it seems, out of friendship – and desperation. My friend the IT pro could not use her regular employees for this project, because you had to be a US citizen and most of her people were Ukrainian. She had a slot to fill and offered it to me.

I arrived at the coordinating meetings with my netbook, which seemed adequate at the time. But everyone else had laptops. Then we got to the work site and the heavy lifting started. Huge spreadsheets. Directories containing hundreds of files. The netbook wasn’t keeping up. My father finally asked me what I wanted for Christmas. “A laptop for work!” I volunteered. He was going to send me a check.

But I needed a better computer NOW and the check was in the mail. I pulled what I thought I could afford out of my account and went down to Fry’s in Renton to see what I could find. I ended up with an eMachines netbox. It had more RAM than my netbook, a faster processor, and Windows 7 Home Premium, 64-bit version. I didn’t need a screen; they came with the cubicles. So I bought it and a USB optical drive at Staples so I could load MS Office onto it, and took it to work that Monday all ready to go.


It took a day for me to figure out that I couldn’t be connected to WiFi and the local LAN at the same time. Then it was time to set up my little machine to manage all this data with a little help from PHP and SQL Server.

Since we were trying to sell Boeing on the idea of switching from Oracle to SQL Server, I thought it would be good PR to use SQL Server (the Express version) as my database.

But first I had to load PHP, and for that I needed a web server. Why not try IIS?

That’s Microsoft’s Internet Information Services. It’s not really a “web server” like Apache. It’s a modularized set of services that can be configured to serve just about anything over the internet. But at that point, I was only dimly aware of this. Articles on the web said I could serve PHP pages using IIS, so I decided to try it.


“Curioser and curioser!” – Alice

I found all the articles I needed to activate IIS on the computer and get it working. But it didn’t work. As I recall, I decided to switch to Apache (httpd). But it still wouldn’t work. It took me about a day to find a comment at the bottom of one of the “how to” articles mentioning the “hosts” file problem.

This is a file that has been used for years to map URLs to IP addresses in cases where the page is not called through a Domain Name System (DNS) server. In personal computers, this file is most commonly used to map the domain “localhost” to the IP address (version 4).

In Windows 7 Home, however, the “hosts” file doesn’t do this. That entry in the file is purposely commented out. Only the “::1 localhost” entry remains. This is it’s IP version 6 address.

So apps that don’t understand IP version 6 can’t find the “localhost” unless this file is modified to provide the IP version 4 address.

When it was time for me to do to my laptop (same operating system) what I had previously done to my netbox, I was ready! But I had to find the data on the “hosts” file all over again, as I couldn’t locate it in my library. It turns out there is even a Wikipedia entry about this file. It is a very famous file in the world of IT!


“Talking of axes,” said the Duchess, “chop off her head.”

Yet, when I went to edit my hosts file, I ran into the other problem that I had somewhat forgotten about: “You don’t have permission to edit this file.” Though I have administrator privileges on my machine, this is the default behavior in Windows 7 to discourage tampering with the operating system.

I was able to edit the permissions on the file to grant myself write permission. This is not the only way to do this; just the first way I thought of. In Windows, there are always usually at least 2, if not 3 or more, ways to do almost anything.

No input file specified

I run the usual test to see if the server can run PHP files properly:

  1. Create a file named “index.php” that contains the string <?php phpinfo(); ?>
  2. Put the file in your “document root.”
  3. Open a browser, and navigate to the file using “localhost” as your domain.
  4. If you get the PHP information page, all’s well.

I got a white screen with a little message in the upper left corner (because I had PHP error reporting turned on – okay in a development environment) that said, “No input file specified.”


It took me another day – maybe longer – to get my browser to respond correctly to the contents of “index.php.”

IIS has a “document root” located at C:\Inetpub\wwwroot. And that’s where I put my file. But that’s not the actual place where I wanted my web applications to be; I wanted them on drive D. So in the PHP configuration file I had told it that my “document_root” was there.

When a browser asks for a PHP file (on localhost) from IIS, IIS will look at the path that PHP expects to find PHP files in. When I moved the file to D: PHP could find it.

It turns out that it is common for a server to look for files in other places in the file system besides its own document root. You just have to tell it to and it will.


I was tired of “running twice as fast just to get somewhere.” So I turned to some projects on my desktop, which has been serving me PHP (and HTML) pages from my drive E: (via Apache) for several years now. What a relief!

However, the battle to turn my laptop into a hot production tool is far from over! There will be at least one sequel to this post!

Sequel: Short version

The laptop is running better now. I learned how to add “virtual directories” in the default directory of IIS. These virtual directories are then mapped to corresponding real directories in the file system. This is the IIS way of enabling you to serve web pages from more than one directory. More complicated than Apache, but also theoretically much more secure.


Tags: , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google+ photo

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

Twitter picture

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

Facebook photo

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


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.