I accidentally turned on error checking for E_WARNING in Wordpress and was greeted with the following message:
PHP Warning: fsockopen(): unable to connect to localhost:80 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond)
What the heck? The web server is obviously running, or I wouldn't have been able to see the error in the first place. And the fsockopen code couldn't be more straightforward.
Google to the rescue! I found PHP bug 44335, where a user complains of the exact same issue.
The solution turned out to be simple. On Windows Vista, there is a file that contains specific hostname to IP addresses. It's found at:
C:\Windows\system32\drivers\etc\hosts
Inside mine, it said:
127.0.0.1 localhost ::1 localhost
The first line is standard - it says to associate the name localhost with the standard loopback address. The second line turned out to be the culprit. I removed that line, and everything worked as normal.
Strange. But, I'll take it.
::1 is shorthand for the ipv6 analogue of the loopback address (0:0:0:0:0:0:0:1). Perhaps the webserver was not listening on the ipv6 interface.
ReplyDelete