Windows 7, localhost, and Drupal

I recently bought a new Windows 7 laptop. Along with all the other basic programming tools, I immediately installed Apache, PHP, and MySQL. One of the first things I wanted to do was to try to install Drupal. I spent two days fighting the white screen of death on Drupal installation, though, and I finally figured out why -- and I can blame it on Windows.

Background: I manually edited settings.php and entered the MySQL connection string, and I navigated to http://localhost/drupal6/install.php. The page would attempt to load for about thirty seconds, and would then give up. No errors were reported, either on-screen or in the Apache error.log.

This post explains what the problem was:
http://dpotter.net/Technical/2009/12/mysql_connect-to-localhost-on-windo...

By default, the Windows hosts file (\System32\drivers\etc\hosts) has the line commented out that maps localhost to 127.0.0.1. What was strange was that I could navigate to a localhost address and Firefox would have no problem resolving it, but mysql_connect would fail to resolve and connect to localhost. All I had to do was un-comment this line in hosts and I was good to go.

Post new comment