For some reason Windows Vista enables IPv6 by default. Why? I wasn’t aware of this so I ended up troubleshooting a non-problem with PHPUnit. I have unit tests that connect to the web server to test a web service. The URL my tests were using was “localhost”. Because vista was resolving localhost to ::1 the tests couldn’t make a socket connection.
All I had to do to fix the problem was disable IPv6 and comment out the localhost ::1 line in my hosts file. This took a significant amount of troubleshooting to figure out though. I thought there was some type of problem with PHPUnit or php itself. Luckily I was finally able to solve the problem.
It seems like a really bad idea for Microsoft to enable IPv6 by default and additionally put it higher in the resolution order than IPv4 addresses. Based on the number of active IPv6 networks this can’t be a good default decision. Supporting IPv6 is a good idea, but it shouldn’t be the default method of resolving addresses. Windows should have knowledge that you are connected to an IPv4 network and disable or lower the priority of IPv6 accordingly.