Edit report at http://bugs.php.net/bug.php?id=50965&edit=1
ID: 50965 Updated by: paj...@php.net Reported by: tony at marston-home dot demon dot co dot uk Summary: fsockopen will not work on 'localhost' Status: Bogus Type: Bug Package: Sockets related Operating System: Windows XP PHP Version: 5.2.12 Block user comment: N New Comment: Fix and discussions will go now into the bug #50953. Previous Comments: ------------------------------------------------------------------------ [2010-02-08 17:55:43] tony at marston-home dot demon dot co dot uk print_r(gethostbynamel('localhost')); produces the following: Array ( [0] => 127.0.0.1 ) ------------------------------------------------------------------------ [2010-02-08 17:39:14] ras...@php.net There is no special-case code in PHP for localhost. Try: print_r(gethostbynamel('localhost')); ------------------------------------------------------------------------ [2010-02-08 17:32:36] tony at marston-home dot demon dot co dot uk I have checked my hosts file, and it only contains the following entry for 'localhost': 127.0.0.1 localhost I have rebooted my PC to clear any cache, but the error is still there. The name 'localhost' works in all the browsers that I use - IE, Firefox, Opera and Safari - so it should work with fsockopen. It works with names I use for other PCs in my home network. I have another PC running Windows XP with IPV6 enabled and PHP 5.3.0, and fsockopen doesn't have a problem using 'localhost' there. ------------------------------------------------------------------------ [2010-02-08 17:07:40] ras...@php.net If 127.0.0.1 works and your name lookup system correctly returns 127.0.0.1 for localhost, then localhost has to work. If it isn't working it is because the lookup isn't returning the correct ipv4 ip. You may have removed it from your hosts file, but perhaps the old answer is cached somewhere. Try restarting things after changing your hosts file. ------------------------------------------------------------------------ [2010-02-08 11:57:49] tony at marston-home dot demon dot co dot uk I did respond in the original bug, but you closed it before finding out if your suggestion about removing the IPV6 entries from my hosts file actually worked. I put in a reply saying that it hadn't worked, but you never re-opened the bug. I assumed that as you had closed it that you were refusing to answer any more queries about it. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=50965 -- Edit this bug report at http://bugs.php.net/bug.php?id=50965&edit=1