If you don’t want to change the global php.ini
, add this line at the top of the controller method or inside your route:
ini_set('max_execution_time', 300); // 5 minutes
Eg:
public function longRunningTask()
{
ini_set('max_execution_time', 300);
// Your heavy process here
}