How to increase maximum execution time in php

  • Added:
  • |
  • In: Basic PHP

I want to increase maximum execution time in php , not by changing php.ini file. I want to Increase it from my php file.

is this possible?

This Question Has 4 Answeres | Orginal Question | Pritesh Mahajan

use below statement if safe_mode is off


You can try to set_time_limit(n). However, if your PHP setup is running in safe mode, you can only change it from the php.ini file.

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

Place this at the top of your PHP script and let your script loose!

Taken from Increase PHP Script Execution Time Limit Using ini_set()

Use the PHP function

void set_time_limit ( int $seconds )

The maximum execution time, in seconds. If set to zero, no time limit is imposed.

This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.

Meet with owner

Sajjad Hossain

Hey, I am Sajjad, working in web development sector since 2012. I love to do amazing things. Let's do a project together.
Connect Social With PHPAns