SimpleTest [Browser] on Vista

Last updated on
30 November 2016

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