Increase PHP Script Execution Time Limit

Every once in a while I need to process a HUGE file. Though PHP probably isn’t the most efficient way of processing the file, I’ll usually use PHP because it makes coding the processing script much faster. To prevent the script from timing out, I need to increase the execution time of the specific processing script. Here’s how I do it.

1. In PHP file:
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
or
set_time_limit(300);

2. in php.ini
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
max_execution_time = 300

; Maximum amount of time each script may spend parsing request data.
; http://php.net/max-input-time
max_input_time = 300

3. in .htaccess file:
php_value max_execution_time 300