php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40287 Opening stream to 'localhost' fails
Submitted: 2007-01-30 13:42 UTC Modified: 2007-02-01 22:49 UTC
From: torarnek at pvv dot org Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.0 OS: Windows Vista
Private report: No CVE-ID: None
 [2007-01-30 13:42 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-01 22:49 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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 18:01:30 2024 UTC