PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #40287 Opening stream to 'localhost' fails
Submitted:30 Jan 2007 1:42pm UTC Modified: 1 Feb 2007 10:49pm UTC
From:torarnek at pvv dot org Assigned to:
Status:Bogus Category:Streams related
Version:5.2.0 OS:Windows Vista
View/Vote Developer Edit Submission

[30 Jan 2007 1:42pm UTC] torarnek at pvv dot org
Description:
------------
When opening a stream to a file in an apache server running locally,
using an url with 'localhost' to refer the local host, it times out with
an error message.

However, using 127.0.0.1 to refer the localhost works.

I searched the web and found a reference to the issue: 
Title: Binding to localhost throws exception in 
http://msdn2.microsoft.com/en-us/vstudio/aa972193.aspx

Reproduce code:
---------------
$url = "http://localhost/scoop/www/test2.html";

$fil = fopen($url, 'r');
if ($fil) {
    while(!feof($fil)) {
       echo fgets($fil);
    }
  fclose($fil);
}

Expected result:
----------------
Should return a stream to the file.

Actual result:
--------------
Warning: fopen(http://localhost/scoop/www/test2.html) [function.fopen]:
failed to open stream: 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. in
E:\workspace\scoop\Scoop\www\test.php on line 6

Fatal error: Maximum execution time of 30 seconds exceeded in
E:\workspace\scoop\Scoop\www\test.php on line 6

[1 Feb 2007 10:49pm UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Not PHP problem.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC