How to Increase PHP Script Execution Time

Default maximum PHP Script Execution Time is 30 seconds, But if you need to process big file then you may have seen your script got crashed, and It throws script execution timeout error. So if your project required to process huge file like exporting big CSV file from MYSql, Then you need to increase PHP Script Execution Time, You can easily increase script execution time by following two ways.

By php.ini file

Open php.ini file in any text editor and find following line max_execution_time and edit it’s value.

max_execution_time = 300 // 300 seconds = 5 minutes



In PHP

Add following code on the top of the page, Where long process need to execute.

ini_set('max_execution_time', 300); // 300 seconds = 5 minutes



Posted in: PHP

One Reply to “How to Increase PHP Script Execution Time”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.