laravelshared-hosting

laravel worker on production shared server


I am using jobs in Laravel but do not know how to them in production on shared server

I 'm not sure my shared server is able to handle the ubuntu supervisor script to handle queues Is there any other way I can make job / queues work in production. I' surprised at the very few & vague answers to this on the net. I am running Laravel 10 [I understand I could be using cron Jobs and a scheduled command to run the worker: (https://stackoverflow.com/q/46141652/2955335) Can any one lead me on the right path


Solution

  • Most shared hosting providers don’t allow running Supervisor scripts, so if you're on shared hosting, cron jobs are the best alternative to handle Laravel jobs, queues, and scheduling. Here's how you can set it up:

    1. Using Cron Jobs for Queues

    2. Using Laravel Scheduler,

      php /project-path/artisan schedule:run >> /dev/null 2>&1

    Budget Consideration If you or your client has the budget, consider moving to a VPS (Virtual Private Server). A VPS gives you full control over the server, allowing you to use Supervisor for managing queues more efficiently. It’s a better option for handling Laravel queues and jobs in production.