Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Yahav's avatar
Level 3

"Maximum execution time of 30 seconds exceeded" in a job

Hey there

I'm running a job that will be queued at production, however during the development i'm running it with the SYNC driver. at the past before i changed some minor code at thejob it used to ran for an hour if needed without any issues. now when i'm running it i'm getting the following message:

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Maximum execution time of 30 seconds exceeded

The thing is, that the job runs for about 25 minutes before i get this message which means its not reallly the 30 seconds execution that is the problem.

can't find the issue at all. anyone got any ideas for me?

0 likes
11 replies
Yamen's avatar

You may try php artisan queue:work --timeout=0 or whatever amount you want.

Helmchen's avatar

can't you split the task into different ones so you don't have any task running more then maybe 2 minutes ? they would scale much better

I would say PHP is still not designed for long-running tasks and I would always want to avoid them

it used to ran for an hour if needed without any issues

What the hell are you doing in the task? :D i see room for optimization :P

Yahav's avatar
Level 3

Yamen: tried that, doesn't work. also, i think that t he default is 0. Helmchen: no can't do :( the job is making tons of requests to external API and receives tens of thousand of texts and analyzes them from different aspects.

rin4ik's avatar

@yahav try again it should work with php artisan queue:work--timeout=0it will remove timeout

Yahav's avatar
Level 3

Well, its running using the SYNC driver, so i put it inside the job class: public $timeout = 0;

Helmchen's avatar

no can't do :( the job is making tons of requests to external API and receives tens of thousand of texts and analyzes them from different aspects.

save an offset and let every Task do only 100 or 1000 .. throw 100 tasks on the queue and spawn as many workers as you need, that's why you actually use a queue and no deamon process

or did i miss something? :)

Yahav's avatar
Level 3

I probably didn't explained it very well but it is required to be one job, as its one report that i'm generating. the queue is there for long and "heavy" processes.

also, i've set the

public $timeout = 0;

but still, same

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_UNKNOWN)
Maximum execution time of 30 seconds exceeded
Cronix's avatar

Try just setting the php time limit manually where you are running this. set_time_limit ( int $seconds ). You can use 0 there (run forever) as well.

Yahav's avatar
Level 3

Ok the

set_time_limit ( int $seconds )

seem to have solved it, however now i get 500 HTTP error at the end and nothing at the laravel log nor the http error log. what on earth is going on

Yahav's avatar
Level 3

but then i won't be able to debug it at the browser wouldn't i?

Please or to participate in this conversation.