Use set_time_limit(timeInSecond or 0); in your script or max_execution_time in php config file(php.ini) for setting execution time of your script. If you want unlimited execution time then use 0 for second.
You may still be getting "execution time exceeded" error after setting long time for "execution time" in php.ini or your script through using set_time_limit(). This may be due to reason other than the script execution. This time only affect your PHP script running and not database connection time, file upload, and so on in your script. If your time is exceeded due to large file upload then you can use max_input_time.
Set_time_limit() only affect your current script, where you write this line.
You may need to check the Apache/ISS timeout as well. Default time there is 300 seconds.