SimpleTest [Browser] on Vista

Last modified: March 8, 2009 - 05:57

The Symptom

[Browser] based SimpleTests are failing when run on your localhost (or any system) running Windows Vista.

The Problem

Windows Vista has added a line to its hosts file that blocks SimpleTest's Browser from fetching pages via the following code in SimpleTest's socket.php file

    function _openSocket($host, $port, &$error_number, &$error, $timeout) {
        return @fsockopen($host, $port, $error_number, $error, $timeout);
    }

The Solution

1. Run notepad as Administrator (find the icon for notepad, right-click->run as Administrator)
2. Navigate to your hosts file (c:\windows\system32\drivers\etc\hosts)
3. Find the line that looks like:

::1             localhost

and remove it, or comment it out with a #

4. Restart apache
5. enjoy working SimpleTest [browser] tests

This should actually be moved

Dave Reid - September 25, 2009 - 02:08

This should actually be moved to a general Drupal on Windows type section, because I'm pretty sure this also causes problems with drupal_http_request and other self-HTTP-request type things.

Drupal freelance developer | www.davereid.net | www.drupalbook.com | Please help sponsor my attendance at DrupalCon S

 
 

Drupal is a registered trademark of Dries Buytaert.