php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1682 file() and fread() still not working on http://server
Submitted: 1999-07-08 20:59 UTC Modified: 1999-07-10 16:58 UTC
From: simon at airdmhor dot gen dot nz Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.11 OS: Linux RH6, 2.2.5-22 kernel
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: simon at airdmhor dot gen dot nz
New email:
PHP Version: OS:

 

 [1999-07-08 20:59 UTC] simon at airdmhor dot gen dot nz
Even with the latest version of PHP, the socket stuff seems a bit broken. Code that used to work fine (on 3.0.6?) remains broken.

eg:
$url = "http://www.php.net/";

// this works
readfile($url);

// this works
$fh=fopen($url,"r");
fpassthru($fh);

// doesn't work for some sites (yes, I know it's an array)
$foo=file($url);                      

// doesn't work for some sites - incomplete result
// consistant location. 
// eg $url="http://bugs.php.net/manual/"
$fh=fopen($url,"r");
$foo=fgets($fh,100000);
close($fh);

They all work fine if $url is set to a local file. Other tools on the same machine (lynx,netscape,wget) can all access the URLs fine.

My PHP is compiled as an apache module, with track-vars, gd, sybase-ct, postgres, and xml; all of which seem to work fine.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-07-08 21:12 UTC] simon at airdmhor dot gen dot nz
Even with the latest version of PHP, the socket stuff seems a bit broken. Code that used
to work fine (on 3.0.6?) remains broken.

eg:
$url = "http://www.php.net/";

// this works
readfile($url);

// this works
$fh=fopen($url,"r");
fpassthru($fh);

// doesn't work for some sites (yes, I know it's an array)
$foo=file($url);                      

// doesn't work for some sites - incomplete result
// consistant location. 
// eg $url="http://bugs.php.net/manual/"
$fh=fopen($url,"r");
$foo=fread($fh,100000);
close($fh);

They all work fine if $url is set to a local file. Other tools on the same machine
(lynx,netscape,wget) can all access the URLs fine.

My PHP is compiled as an apache module, with track-vars, gd, sybase-ct, postgres, and xml;
all of which seem to work fine.



 [1999-07-08 21:26 UTC] simon at airdmhor dot gen dot nz
(hmmm, I expected it to overwrite my initial bugreport)
That last change was correcting a typo where
   "$foo=fgets($fh,100000);"
should have read
   "$foo=fread($fh,100000);"

 [1999-07-10 13:07 UTC] sas at cvs dot php dot net
Recompile and let us know whether it works now:

$ cd php-3.0.11/functions
$ wget -O fsock.c http://cvs.php.net/cvsweb.cgi/functions/fsock.c?rev=1.124
 [1999-07-10 16:58 UTC] sas at cvs dot php dot net
fixed in CVS
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 04:00:01 2026 UTC