Increase PHP execution time
Ways to Change PHP Program Execution Time
There are various ways to change the value that is set with the PHP configuration file. These are,
1)Use the PHP function set_time_limit() that accepts the execution time limit in seconds as its argument.
$execu_time_limit = 60;
set_time_limit($execu_time_limit);
2) Search the php.ini file for a max_execution_time directive and edit its default value as required.
If we have access to the php.ini file then we can see the settings related to max_execution_time, like.
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30
3) Use the ini_set() function in a PHP program by specifying the php.ini file directive name and its corresponding value to be set.
ini_set("max_execution_time", 120);
4)Use the php_value command in the .htaccess file to set max_execution_time.
We can change the value of the execution time limit with the .htaccess file by using the php_value command as like as follows.
php_value max_execution_time 200
NOTE:- For infinite time we pass 0 in seconds.
set_time_limit(0);
max_execution_time = 0
ini_set("max_execution_time", 0);
php_value max_execution_time 0
Comments
Post a Comment