Using ini_set()
, I can expand the maximum execution time of a script. In Symfony2, I can add ini_set
to web/app.php
and web/app_dev.php
to apply the increased execution time to all controllers.
But in this case, I only want to expand the maximum execution time for one specific controller action in Symfony2. I’d rather not give other actions the possibility to run for a longer time than necessary.
I tried adding the ini_set
at the top of the action function in the controller, but that doesn’t seem to work. Any solutions? Thanks!
Advertisement
Answer
You can disable the PHP timeout limit with the set_time_limit
function. More info here
as Example:
class TaskController extends Controller { public function longTaskAction() { set_time_limit(0); // 0 = no limits // .. } }