How to increase maximum execution time in php [duplicate]

别来无恙 提交于 2019-11-26 01:14:54

问题


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?


回答1:


ini_set('max_execution_time', '300'); //300 seconds = 5 minutes
ini_set('max_execution_time', '0'); // for infinite time of execution 

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()




回答2:


use below statement if safe_mode is off

set_time_limit(0);



回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/16171132/how-to-increase-maximum-execution-time-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!