#3187 [Opn->]: CPU overload with fopen() and fgets()
| From: | hholzgra@php.net | Date: | Tue, 01 Oct 2002 19:14:25 +0000 |
| Subject: | #3187 [Opn->]: CPU overload with fopen() and fgets() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-21060@lists.php.net to get a copy of this message | ||
ID: 3187
Updated by: hholzgra@php.net
Reported By: alister@xcel.net.au
-Status: Open
+Status: Won\'t fix
Bug Type: Misbehaving function
Operating System: NT 4.0 SP 5 on intel
PHP Version: 3.0.14
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2000-01-12 06:15:10] alister@xcel.net.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;
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=3187&edit=1