Skip to content

Using Laravel Queues on Shared Hosting

When all you have is CRON!

Sometimes, shared hosting must be used that does not permit the installation of supervisor to run the queue worker. A common example of this are servers deployed with cPanel access only.

One approach for non-time sensitive queue work (such as sending emails) is to add a task to the scheduler that starts the queue worker every minute

Option A
Add this to your console config in Laravel

$schedule->command('queue:work --stop-when-empty')->everyMinute()->withoutOverlapping()

For cPanel servers, the Cron statement might look like;

* * * * * /usr/local/bin/php /home/{account_name}/live/artisan schedule:run

Option B
Run both the scheduler and the queue:work from cron

* * * * * /usr/local/bin/php /home/{account_name}/live/artisan schedule:run
* * * * * /usr/local/bin/php /home/{account_name}/live/artisan queue:work --stop-when-empty

Leave a comment