Search code examples
laravelubuntularavel-artisan

php artisan queue:work freeze in terminal


I use the queue in my Laravel 5.4 project to send emails in background. I have created the table for jobs, created the class for the job, and put QUEUE_DRIVER=database in my .env file. When I dispatch my Job, I can see my task in the jobs table. So far so good.

However, when I then execute the command php artisan queue:work on the webserver - it's freezing and not have any results.

What could be the problem?

Queue


Solution

  • This probably is because this is a service that uses the current thread in Ubuntu (from your tag). If you add a &, the process will run in a forked thread.

    php artisan queue:work &

    Or after a quick google, you can have a look at

    nohup php artisan queue:work --daemon &