Last week, I decided to try migrating to Windows Vista again. Yeah, yeah, save it. Anyway, after spending the last two hours trying to figure out why Apache’s mod_rewrite feature was not working, and then discovering it was the stupidest of the most stupid possible reasons, I decided to post a few “warning signs” here for you comrades who are traveling the WAMP road. (For the unitiated, that’s “Windows/Apache/MySQL/PHP.” And if you don’t know what that means, then this post isn’t for you anyway.)
And hey, it’s already two in the figgin’ morning and I’m sure Apple is already asleep by now, so I might as well waste even more time. <sarcastic smirk>
Pick the Right Version
When installing Apache on Windows Vista, use Apache 2.2.x, not 1.x. Of course, you could always install IIS instead, if you like that sort of thing. I like to run both — since I often develop for both ASP.NET and Linux/PHP architectures. Two HTTP servers will coexist if you bind them to different ports — say, 80 and 8080.
Fixing Slow Apache Response
After Apache is installed, accessing it through your computer name (in my case, http://exeter) may be very slow. To correct this, add this line to your HOSTS file (you’ll find it in C:Windowssystem32driversetc):
Of course, you’d replace “exeter” with your computer name. This is not necessary if you prefer to access your server via http://localhost or http://127.0.0.1, as those should be working perfectly right out of the box.
Can’t Get the PHP MySQL Extension to Load?
No matter what your settings are in php.ini, The PHP MySQL module will not load unless you copy libmysql.dll to C:Windowssystem32. You will find this file in the PHP root directory.
MySQL Instance Config Wizard Hangs on Last Step
When configuring your MySQL 5 server with the Instance Config Wizard, when you get to the last step and press “Execute,” the wizard may lock up. If so, open Task Manager, right-click on the MySQLInstanceConfig.exe process and select “Properties.” On the “Compatibility” tab, check “Run this program in compatibility mode for:” and then choose “Windows XP (Service Pack 2)” from the drop-down menu. Click OK, then terminate the process. Run the MySQL Instance Config Wizard again. It should work this time.
Lastly, Make Sure You Edit Config Files on C: with Elevated Privileges
This is the pain-in-the-ass step that cost me two hours of time tonight. When editing config files for your server software — for example, Apache’s httpd.conf — make sure you launch your text editor as Administrator. In other words, with elevated privileges. Otherwise, it may not have the ability to write to files on the C: drive — but it may not tell you so, either.
I have my favorite text editor bound to a shortcut in my context menu, so I can right-click on any file and open it in my editor. But this context menu shortcut does not launch the editor with elevated privileges. Absurdly, I spent two hours continually editing, checking and re-checking httpd.conf, thinking I had enabled Apache’s mod_rewrite module, when in fact I had not — because the file was not getting saved, due to the editor’s lack of security privileges.
Unfortunately, the editor threw no error messages and in fact behaved as if everything was normal. It wasn’t until I shut down the editor, started it back up and opened httpd.conf that I noticed none of my changes had actually been saved. RAGE!
By the way, this “elevated privileges” crap is a new requirement of Windows Vista, which is the first Windows operating system that runs the typical user account with a restricted set of privileges. It’s safer to do this, but it’s a new concept to Windows users (and developers of Windows software). This creates problems with all kinds of older, pre-Vista software in particular, because all of it was designed around the assumption that every user would have admin-level access all the time. That is no longer true.
Sigh. Anyway, everything with my WAMP setup is finally working now. This rigmarole was the perfect way to terminate a screwed-up, costly, merry-go-round of a week, which I’ll tell you about in more detail tomorrow. For now, suffice it to say, I’m going the frak to bed.