Categories
PHP

Increase PHP Script Execution Time Limit Using ini_set()

Today I had to set the PHP script execution time directly from within the php file. Here’s what I did.

Add the following code to your file. You can change the seconds to what you need. It is important to be careful using this on a live server. If you allow a script to run too long you could hog all your servers resources and bog the site way down. 5 minutes is a lifetime in server time and it might be longer than you need.

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