Sometimes, shared hosting must be used that does not permit the installation of supervisor to run the queue worker.

A typical example of these 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;

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

Adding this line to the scheduler in app\Console\Kernel.php and then setting up a cron job to run the scheduler, ensuring that the queue gets serviced every minute.

For Cpanel servers, the Cron statement might look like this –

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

where {account_name} is the user account that cPanel is running under and live is the folder of the laravel application

https://rdevs.xyz
Do you like Ashiqur Rahman's articles? Follow on social!
Comments to: Using Queues on cPanel Shared Hosting with Laravel

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

Login

Welcome to rDevs

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join rDevs

start writing