Jump to content

Have a CPU overload when trying to get file from apache


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.