This article describes how to change the maximum execution time for PHP scripts by using the max_execution_time directive in a php.ini file.
Using the max_execution_time directive
By default, the maximum execution time for PHP scripts is set to 30 seconds. If a script runs for longer than 30 seconds, PHP stops the script and reports an error. You can control the amount of time PHP allows scripts to run by changing the max_execution_time directive in your php.ini file.
To change the maximum execution time, use a text editor to modify the max_execution_time directive in your php.ini file. For example, to set the maximum execution time to 40 seconds, use the following setting:
max_execution_time = 40
The second method is to fix it by editing your .htaccess in the same directory as the executing script by include this line
php_value max_execution_time ?
Replace “?” with the with the value you need to replace it with.
php_value max_execution_time 259200