PHP by default limits the execution time of a script to 30 seconds. If the script exceeds this time limit, the process is “killed”, in other words the process is terminated.
To get around this problem there is the set_time_limit() function, which sets a new maximum execution time for the script, in seconds.
Example:
//Define o tempo máximo de execução do script em 60 segundos set_time_limit(60);
For more detailed information, visit the official PHP manual: http://php.net/manual/pt_BR/function.set-time-limit.php