Ionos, who host my vehicle tracking website, have recently changed to php 7.2.15
One page that processes lots of data, which used to run fine, now times out and doesn't finish. It is a report that is only run weekly, so it doesn't matter that it takes a few minutes to run.
While I can't give the esteemed YACF members access to a load of data about where the vehicles have been, I've put together a page that times out in the same way.
It's here:-
http://www.mtrak.co.uk/timeout.phpThe count should get to 100, but it just stops after what I think is 30 seconds of execution time. The time (in ms) comes from a function that uses getrusage that I'm only using for diagnostics but I don't fully understand.
When I try to change the timeout with
either set_time_limit(1000)
or ini_set('max_execution_time',300)
then the code stops after 50 seconds with no warning. Those can be seen here:-
http://www.mtrak.co.uk/timeout.php?s=1http://www.mtrak.co.uk/timeout.php?i=1The information about the php version is here:-
http://www.mtrak.co.uk/info.phpThe php code for the timeout demonstration page is:-
<?php
error_reporting(E_ALL);
$rustart = getrusage();
if (isset($_GET['i'])){ini_set('max_execution_time',300);}
if (isset($_GET['s'])){set_time_limit(1000);}
function rutime($ru, $rus, $index) {
return ($ru["ru_$index.tv_sec"]*1000 + intval($ru["ru_$index.tv_usec"]/1000))
- ($rus["ru_$index.tv_sec"]*1000 + intval($rus["ru_$index.tv_usec"]/1000));
}
$a = 1;
while ($a < 100)
{
$ru = getrusage();
echo $a .' Time so far:' . rutime($ru, $rustart, "utime") . '<br/>';
$a++;
$b = 0;
while ($b < 10000000)
{
$c=0;
while ($c < 5)
{
$c++;
}
$b++;
}
}
?>