Results 1 to 13 of 13
  1. #1

    Question PHP TimeOut HALT my script before end

    Here my problem, my script running for 5 min and stop suddently.
    ini_set('error_reporting', E_ALL); error handling do not show me any error. I post data, and make some sleep between each of them.

    I've think that could be explorer that timeout my script so i change my timeout value of my explorer with no result script still stop.

    set_time_limit() function
    and the configuration directive
    max_execution_time do not help prevent my script halting.

    I timeout during my sleep(); fonction, where nothing could halt the code. Well if someone have an idea to help me that will be greatly appreciated. Thanks.

  2. #2
    Join Date
    Mar 2004
    Location
    USA
    Posts
    4,342
    can we see the code :roll:

  3. #3

    Here the code ...

    I created TimeRolex to test if my sleep was causing my script to timeout. The Script halt in the timerolex ... or during sleep. I already test

    sleep(10);
    echo " . ";
    sleep(10);
    echo " . ";
    sleep(10); --- Script stop here sometime ...
    echo " . ";
    sleep(10);
    echo " . ";

    It's about timeout or something like that. The script halt before i see terminated!! If that help you here the simple loop.

    function timerolex($holdtime){
    $c_min = date("i"); //Current Minute
    $c_sec = date("s");
    $now = $c_min * 60 + $c_sec;

    echo "Min : ".$c_min." Sec : ".$c_sec."\n\r<br><br>";
    $holdtime=$holdtime+$now;

    echo "Now : ".$now." HoldTime : ".$holdtime."\n\r<br><br>";
    while ($now<$holdtime) {
    $c_min = date("i"); //Current Minute
    $c_sec = date("s");
    $now = $c_min * 60 + $c_sec;

    }

    echo "Now : ".$now." HoldTime : ".$holdtime."\n\r<br><br>";
    $c_min = date("i"); //Current Minute
    $c_sec = date("s");

    echo "Min : ".$c_min." Sec : ".$c_sec."\n\r<br><br>";
    }


    $file = fopen ("data.txt", "r");

    if (!$file) {
    echo "FILE NOT PRESENT.\n";
    exit;
    }

    while (!feof ($file)) {

    // POST CODE

    $findme = 'RESULT OK';

    $ifpresent = strpos($return_content, $findme);

    if ($ifpresent === false) {

    // NOT OK
    timerolex(10);

    } else {

    // OK
    timerolex(60);
    }


    }
    fclose($file);
    echo "<b>Terminated</b>";

  4. #4

    Why? How to see every error code?

    My last try halt during my timerolex() again;

    //POST

    Min : 06 Sec : 55

    Now : 415 HoldTime : 475 ... and stop here as always after 5 min running.

    Any way to see every error, why a script halt and ini_set('error_reporting', E_ALL); do not return any error.

    still looking to answer myslef!!

  5. #5

    again ...

    set_time_limit(0);
    ignore_user_abort(true);
    ini_set("max_execution_time",0);

    do not help my script to avoid my timeout problem. I'm going crazy and feeling dumb. I go to bed! I really need it. thanks for reply.

  6. #6
    Join Date
    Jun 2002
    Location
    Kansas City
    Posts
    12

  7. #7
    Originally posted by BenSummers
    i think if php is in safe mode you cannot change the time limit as safe mode does everything it can to castrate php but its just something to check
    Correct.

    set_time_limit() has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.
    http://us4.php.net/manual/en/functio...time-limit.php
    Advanced Forum Hosting
    http://www.boardnation.com
    Easily build a community today!

  8. #8

    safe mode off

    safe_mode : off
    max_input_time : -1
    post_max_size : 8M

  9. #9
    Join Date
    Mar 2004
    Location
    Poland, Lublin
    Posts
    71
    type

    SET_TIME_LIMIT($seconds)

    more php.net

  10. #10

    already set

    set_time_limit(1000000);
    ignore_user_abort(true);
    ini_set("max_execution_time",1000000);

    is already on the top of my page. The cause must be browser timeout or system timeout.

    PHP Version 4.3.4 - FreeBSD 4.7 ... let you know if i solve my problem.

  11. #11

    Example :

    I think that my problem is the same as this script, i loop without sending data for enough long of time to timeout. If someone can try it if you timout after about 5 min, and how to avoid that? It's not system or broswer timeout. still testing ... thanks for reply


    set_time_limit(1000000);
    ini_set("max_execution_time",1000000);

    echo "<html>
    <head>Test
    </head>
    <body>
    ";
    echo "Start\n\r<br>";
    flush();
    ob_flush();
    $temp = 100;
    while ($temp<1000) {
    }
    echo "
    Terminated
    </body>
    </html>
    ";

  12. #12

    answer is ...

    that my hosting provider do not allow script running more than 5 min,

    [httpd.conf]

    Timeout 300

    surement ... anyway just hit reload!! thanks every1

  13. #13

    Save time!

    <body onload="window.location.reload()">

    and remember the last position ... and everything going right!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •