DEV Community

Raiyan Memon
Raiyan Memon

Posted on

1

Running Laravel Queue Worker in Production

Laravel Queue Worker plays an important role in running in the background. It does not put a load on our web application.

For firing mail and any other stuff that takes time for such tasks, we can schedule a queue worker.

In this we are going to see how we can schedule our queue worker on the production server.

Most people including me had a hard time running this command on the production server we can just keep running “php artisan queue:work” every time so I got the solution.

Go inside your code folder on the server and just place this command and hit enter twice.

nohup php artisan queue:work --daemon &

Congratulations! You just fired a command which will keep the worker running even if you close the console of your server.

One more thing if you have made any changes in the queue worker code and something related to that and the changes do not reflect on the production link just restart the queue with this command.

php artisan queue:restart

This will stop the command of keeping up the queue worker and then run

php artisan optimize:clear

This command is mandatory because Laravel stores the cache and does not clear it by default.

After this just hit the first command and your queue worker is automated again.

Keep coding and exploring❤️

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay