Jump to content

Have a CPU overload when trying to get file from apache


YuriM

Recommended Posts

Hi.

I have 90-99% CPU when trying to download file by using this code. And after debugging the code Ive found that CPU overload happens on the 'echo $result;' row.

Class uses fsockopen function to get a file and returns data binary string. On the other side if I put file on the server and trying to download it I have no trouble with CPU overload.

 

Here is the part of code.

$http = new HttpClient(SERVICE_ADDRESS, SERVICE_PORT);

$http->get( $parts['path'].'?'.$parts['query'] );

$result = $http->getContent();

 

header('Content-Type: '.$mime );

header('Content-Disposition: attachment; filename="'.$filename.'"' );

header('Content-Length: '.strlen( $result ) );

echo $result; // This string kills CPU

exit();

 

As I've said I dont understand WHY echo on string I got from thet overload CPU.

If someone can explain me what may be happens and what have I do.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.