intanto userei questo: http://php.net/manual/en/function.set-time-limit.php
in secondo, leggerei questa nota:
le query nel database non rientrano nel conteggio del time limit. Non sembra neanche esserci una possibilità in mysql di impostare un timeout su una query, ho dato uno sguardo in giro, tutti dicono eventualmente di killare il processo o cose simili. Quindi dovresti lanciare lo script in background e uccidere il processo se va in timeout. Come fa questo nella risposta: http://php.net/manual/en/function.se...mit.php#115057The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real.