why does downloading timeout in this script?

Discussion in 'PHP' started by keyvan1, Jun 9, 2008.

  1. #1
    hi,
    i have a php proxy script and i have installed it on my website
    when downloading through proxy it downloads the first 6 to 7 mb of data.if the file is greater than 7 mb it timesout what can i do for that
    ofcourse i my connection speed is 128 kb
    but can the code be changed so that it does not timeout?
    i have attached the code
     

    Attached Files:

    keyvan1, Jun 9, 2008 IP
  2. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #2
    You can set the maximum timeout in php.ini or in the top of your script:
    set_time_limit(0);
     
    Lordo, Jun 9, 2008 IP
  3. keyvan1

    keyvan1 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    sorry i know very little about php
    you mean in the index.inc file
    like this?
    <?php
    set_time_limit(0);[/
    if (basename(__FILE__) == basename($_SERVER['PHP_SELF']))
    {
    exit(0);
    }

    echo '<?xml version="1.0" encoding="utf-8"?>';

    ?>
     
    keyvan1, Jun 9, 2008 IP
  4. Lordo

    Lordo Well-Known Member

    Messages:
    2,082
    Likes Received:
    58
    Best Answers:
    0
    Trophy Points:
    190
    #4
    Yes try that
     
    Lordo, Jun 9, 2008 IP
  5. keyvan1

    keyvan1 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i have tried and set that timeout to a big number but again approximately after 5 minutes the download terminates
    how is that
    i have read this too:
    there seem to be other options
    i am using a php host:
    http://ir.php.net/manual/en/function.set-time-limit.php
     
    keyvan1, Jun 9, 2008 IP
  6. keyvan1

    keyvan1 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    i found this too:
    Timeouts after five minutes in IIS on Windows are caused by an inherited CGI Timeout value of 300 seconds. This is not a PHP problem. The fix is to add custom values for the files or directories that need longer to run.

    In IIS 5.0 or 7.0 (beta as of this note), you can change this value on a fairly granular level using IIS Manager, under (roughly) YOURSITE -> Properties -> Home Directory -> Configuration (button) -> Options, but in IIS 6.0, this functionality is turned off (!), so you have to get into the Metabase.

    Find the site number in Metabase Explorer (e.g., 12345678), then from CMD prompt:

    [get to the scripts dir]
    cd C:\Inetpub\AdminScripts

    [this for each subdirectory from off the site root]
    cscript adsutil.vbs CREATE W3SVC/12345678/root/"MY SUBDIRECTORY" IIsWebDirectory

    [this for the file in question]
    cscript adsutil.vbs CREATE W3SVC/12345678/root/"MY SUBDIRECTORY"/ILikeToTimeOut.php IIsWebFile

    [this to set the timeout]
    cscript adsutil.vbs set W3SVC/12345678/root/"MY SUBDIRECTORY"/ILikeToTimeOut.php/CGITimeout "7200"

    Note: "7200" is 2 hours in seconds, but can be whatever.

    I derived the solution above from this fine article:
    http://www.iis-resources.com/modules/AMS/article.php?
    storyid=509&page=3
     
    keyvan1, Jun 9, 2008 IP