php timeout - set_time_limit(0); - don't work

前端 未结 5 1330
感动是毒
感动是毒 2020-12-15 04:25

I\'m having a problem with my PHP file that takes more than 30 seconds to execute.

After searching, I added set_time_limit(0); at the start of the code,

5条回答
  •  有刺的猬
    2020-12-15 04:52

    Checkout this, This is from PHP MANUAL, This may help you.

    If you're using PHP_CLI SAPI and getting error "Maximum execution time of N seconds exceeded" where N is an integer value, try to call set_time_limit(0) every M seconds or every iteration. For example:

    query($sql);
    
    while ($row = $stmt->fetchRow()) {
        set_time_limit(0);
        // your code here
    }
    
    ?>
    

提交回复
热议问题