php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3187 CPU overload with fopen() and fgets()
Submitted: 2000-01-12 06:15 UTC Modified: 2002-10-01 14:14 UTC
Votes:3
Avg. Score:2.7 ± 1.2
Reproduced:0 of 0 (0.0%)
From: alister at xcel dot net dot au Assigned:
Status: Wont fix Package: Misbehaving function
PHP Version: 3.0.14 OS: NT 4.0 SP 5 on intel
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: alister at xcel dot net dot au
New email:
PHP Version: OS:

 

 [2000-01-12 06:15 UTC] alister at xcel dot net dot au
I'm using latest release PHP4 beta 3 (couldn't pick that as a selection in the PHP Version pull-down - sorry). Also latest win32 Apache.

When I run the code below on an external URL (in this case http://directory.netscape.com/) PHP gets as far as entering the while loop but appears to go out of control on the fgets(). I am getting variable CPU usage between 95 and 100%... it's maxing out my processor! I don't know how long it would go for... I eventually rebooted (manuy times!) because I couldn't kill the PHP.exe process. 

NOTE: The script max timeout variable doesn't work outside UNIX and this is something to overcome, please!

I tried a work around using readfile() and explode() to get the array back, but readfile() sends to standard output and I don't know how to suppress this.

I'm notifying of this bug (I'm not alone... there's a note on one of the online manual pages about the exact same error in PHP v3.something) but also asking for any workarounds for the time being.

Thanks,

ALister.

-------------------------------------------------

function grabFile ($url, $ignoreme)
{
  $fp = fopen ($url, "r");
  $i = 0;
  echo " ";
  flush ();
  while (!feof($fp))
  {
    $file[$i] .= fgets ($fp,1024);
    $i++;
    //echo $i." <br>";
    flush ();
  }
  echo " ";
  flush ();
  return $file;
}

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-01 14:14 UTC] hholzgra@php.net
We are sorry, but can not support PHP 3 related problems anymore.
Momentum is gathering for PHP 5, and we think supporting PHP 3 will
lead to a waste of resources which we want to put into getting PHP 5
ready. Ofcourse PHP 4 will will continue to be supported for the
forseeable future.

using curl in php4 might help
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 09 20:01:29 2024 UTC