Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Default Heavy File Downloads

    Hello,
    Im making a script in order to force a download, opening it with fopen() and fread().
    The thing is, everything works great, but if files are larger than 240mb, the thing gets screwed.

    I have configured:

    memory_limit = -1
    max_execution_time = 5400
    max_input_time = 5400

    And set the "maximum memory usage for process until cpanel kills it" to unlimited.

    What can be the problem?
    Im using set_time_limit(99999); too.

    Thanks

  2. #2
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Default Test

    I have runned a test, and it stops at 252,9mb...

    Here you have the code:

    PHP Code:
    <?php
    // ARCHIVO
          
    $f $_GET["f"];
    // PESO
          
    function urlfilesize($url,$thereturn) {
    if (
    substr($url,0,4)=='http') { 
    $x array_change_key_case(get_headers($url1),CASE_LOWER);
    $x $x['content-length'];
                }
    else { 
    $x = @filesize($url); }
    if (!
    $thereturn) { return $x ; }
    elseif(
    $thereturn == 'mb') { return round($x,2) ; }
    elseif(
    $thereturn == 'kb') { return round($x,2) ; }
    }

    // Tengo PESO
    $peso urlfilesize($_GET[f],'');

    // Headers
          
    $name explode("/"$f);
          
    $nc count($name);
         
    $nombre $name[$nc-1];
            
    header("Content-Description: File Transfer");
          
    header("Content-type: application/octet-stream");
          
    header("Content-Disposition: attachment; filename=\"$nombre\"\n");
          
    header("Content-Length: ".$peso);
          
    header("Cache-Control: no-store, no-cache, must-revalidate");

    // Imprimir
    $fp=fopen("$f""r");
    while(!
    feof($fp)) {

           echo 
    fread$fp$peso);
               
    stream_set_timeout($fp99999);
                
    set_time_limit(99999);
           
    ob_flush();
           
    flush();
           
    }
    fclose$fp );

    ?>
    Is there a limitation in cpanel?

  3. #3
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Our technical analysts can look over your configuration settings to see if there's any configuration issue that is causing this to happen: http://tickets.cPanel.net

    Note, if this is a PHP script issue rather than a PHP/server configuration issue, it will be up to you to debug your PHP script.

Similar Threads & Tags
Similar threads

  1. Heavy DDoS attack
    By MoOZ125 in forum Security
    Replies: 9
    Last Post: 11-17-2010, 10:40 AM
  2. Heavy Roundcube
    By Silent Ninja in forum E-mail Discussions
    Replies: 14
    Last Post: 09-27-2009, 08:07 PM
  3. Heavy.pm fails
    By PDW in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 08-18-2009, 09:17 PM
  4. file downloads corrupt following apache update
    By daisylei in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-20-2008, 01:45 PM
  5. File downloads
    By ScoutZilla in forum New User Questions
    Replies: 5
    Last Post: 08-11-2006, 12:29 PM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube