|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12965 fopen() don't open URL files
Submitted: 2001-08-26 10:45 UTC Modified: 2001-08-28 14:24 UTC
From: ronaldo at inbox dot lv Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.6 OS: Windows2000
Private report: No CVE-ID: None
 [2001-08-26 10:45 UTC] ronaldo at inbox dot lv
I'm using PhP 4.0.6 with Apache 1.3 and the
problem is opening remote files with fopen("http://...");

The following code:

>$fp = fopen("", "r") or die("OPEN");
>while (! feof($fp))
>    fread($fp, 1024) or die("READ");
>fclose($fp) or die("CLOSE");

Produced the following output:

>Warning: php_hostconnect: connect failed in filename.php..
>Warning: fopen("","r") - Bad file
>descriptor in filename.php..

I tried to use fsockopen() with my IE proxy and port settings - it was successful. Maybe the problem is in Apache configuration, but I just can't figure that out!

If you can help, please, send to my email:

Kind regards


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-28 14:24 UTC]
I got a slightly different error:

Warning:  fopen("","r") - No error in e:\sander\webserver\http\test\test1.php on line 10

If you append a / to the url, it works:
fopen("", "r")

The errors are a bit weird though...

Let's make it a bogus.
 [2004-01-05 04:29 UTC] filipoiu_victor at yahoo dot com
try this:
$my_file = file ("");

it will result:
No error in my_script.php on line xxx

I have Win98SE
PHP 4.3.4
OmniHTTPD 2.10
IE 5.5

The same thing works under PHP 4.3.4, Win2000 with IIS and IE6
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC