1

I have a problem on PHP. I want to create a timeout error after a fixed delay (stop an execution after a maximum time). I use set_time_limit for that.

I use this script for the test :

<?php
set_time_limit(1);

sleep(10);
echo "END";

But this page does not display a Timeout error. It displays "END" !

ADyson
  • 57,178
  • 14
  • 51
  • 63
idIA Tech
  • 23
  • 3
  • 2
    [Read here](https://www.php.net/manual/en/function.set-time-limit.php#115057): _Both `set_time_limit(...)` and `ini_set('max_execution_time',...);` won't count the time cost of `sleep`,`file_get_contents`,`shell_exec`,`mysql_query` etc..._ – Alon Eitan Dec 24 '22 at 10:23
  • Oh, right. I guess the only way to manage the counter and the error itself – idIA Tech Dec 25 '22 at 11:12

0 Answers0