How to set maximum runtime for php script?

I would like to change the maximum runtime for a PHP script. In a script, I tried

ini_set("max_execution_time", "1000"); 

and

 set_time_limit(1000); 

together and separately.

I also added this line to .htaccess:

 php_value max_execution_time 1000 

php.ini has safemode, and the Apache server has the AllowOverride All flag. What should I do so that the server can increase the execution time?

+7
source share
2 answers

Setting the variable in the ini file works for me:

 max_execution_time = 1000; 

set_time_limit () should also work if it is not in safe mode.

+5
source

If you are looking for the Apache2 directive to use in .htaccess or to configure a single VirtualHost, you probably need php_admin_value:

 php_admin_value max_execution_time 1000 

AFAIK this only works with mod_php

+5
source

All Articles