I have a PHP script that has a runtime of 34 seconds. But it dies after 30 seconds. I guess my webhost a time limit of 30 seconds.
I am thinking of splitting the script
Running it as CLI will automatically eliminate time limit. You can use cron for that as described by Salman A. I have script that run for every 30 minutes. It does like this:
$startTime + $timeLimit) && ($min >= 29 || $min >= 59) )
{
echo "STOPPING...
\n";
return true;
}
else
{
return false;
}
}
?>
Why I did that? because I've read somewhere that PHP is very bad at garbage collection. Therefore I kill it every 30 mins. It's not that robust. But, given the constraint of shared hosting. This is my best approach. You can use that as template.