Set max_execution_time for a specific controller in symfony2

Using ini_set() , I can increase the maximum execution time of the script. In Symfony2, I can add ini_set to web/app.php and web/app_dev.php to apply extended runtime to all controllers.

But in this case, I only want to increase the maximum execution time for one action of a specific controller in Symfony2 . I would prefer not to give other actions the opportunity to work for a longer time than necessary.

I tried adding ini_set at the top of the action function in the controller, but this does not seem to work. Any solutions? Thanks!

+5
source share
1 answer

You can disable the PHP timeout limit using the set_time_limit function. More here

as an example:

 class TaskController extends Controller { public function longTaskAction() { set_time_limit(0); // 0 = no limits // .. } } 

Hope for this help

+5
source

Source: https://habr.com/ru/post/1244202/


All Articles