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

sannjay's avatar

Laravel 5.5 Queue solution with shared hosting

I have searched a lot about this before posting it here and I think still there is no clear answer. The most elegant solution is from @daem0n posted in other thread

$schedule->command('queue:work --daemon')->everyMinute()->withoutOverlapping();

However, some people has reported that this was keeping the schedule:run command going and was creating several new queue:work commands.

In Laravel 5.5, I saw this code $schedule->job(new Heartbeat)->everyFiveMinutes();

https://laravel.com/docs/5.5/scheduling#scheduling-queued-jobs According to doc-

The job method may be used to schedule a queued job. This method provides a convenient way to schedule jobs without using the call method to manually create Closures to queue the job

Not sure if this is the right solution to run queue:work without any problem? What are you using for shared hosting where you can not access shell ?

0 likes
7 replies
bashy's avatar

I think the good shared hosts now support SSH. What hosting are you using?

There's no real solution for using queues without some sort of cron job functionality.

1 like
sannjay's avatar

@bashy I have cron job functionality in my shared hosting. I am asking what is the correct way to run the queue:work ? This is what I have already added in my cron tab

* * * * * /usr/local/bin/php /path/to/artisan schedule:run >> /dev/null 2>&1
bashy's avatar

For my queues, I use

queue:work --sleep=3 --tries=3
1 like
sannjay's avatar

Thank you @bashy for replying back

How do you use it ? Via laravel scheduler or you are using it directly in cron tab

I mean Like this

$schedule->command('queue:work --sleep=3 --tries=3')->everyMinute()->withoutOverlapping();

OR like this

* * * * * /usr/local/bin/php /path/to/artisan queue:work --sleep=3 --tries=3 >> /dev/null 2>&1
bashy's avatar

I run this in crontab file

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

And this in supervisor config

php artisan queue:work --sleep=3 --tries=3
1 like
sannjay's avatar

I can not install supervisor on a shared host..

bashy's avatar

No so you could just run the queue:work every minute on a cron job without the daemon running.

1 like

Please or to participate in this conversation.