File decryption + download = 100% CPU

    Date: 11/24/07 (PHP Community)    Keywords: no keywords

    Need your help guys!

    We have the script that decrypts the file and sends it to the user:

    
    ----------------------------------------------------
    
    header("Pragma: cache");
    header("Content-type: application/force-download"); 
    header("Content-Transfer-Encoding: Binary"); 
    header("Content-length: ".$this->getSize()); 
    header("Content-disposition: attachment; filename=\"".$name."\"");
    
    ...
    
    $bytes_number = 1024;
    
    ...
    
    while ($bytes_already_read < $file_size) {
    
      $bytes = fread($file_handle, $bytes_number);
    
      for ($i=0; $i
    But when I start a single download (~400 kb/sec) it freezes the server.
    Apache starts eating 100% CPU.

    What can you suggest?

    Source: http://community.livejournal.com/php/597926.html

« Can't get PHP5 to read... || database and check boxes »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home