Menu

Laravel Queue Worker on cPanel Without Supervisor
πŸ“°

Laravel Queue Worker on cPanel Without Supervisor

DEV Community: laravelΒ·FaizanΒ·11 days ago
#o4r50LrZ
#devtolaravel#devto#dev#queue#worker
Reading 0:00
15s threshold

The Laravel docs tell you to keep queue:work running with Supervisor. On cPanel shared hosting you cannot install it, so emails, PDFs and imports sit in the jobs table and never run. This guide shows two ways to run a Laravel queue worker on cPanel without Supervisor: a cron job every minute that starts a worker and lets it exit, or the same worker started by Laravel's scheduler. Both stay inside CloudLinux limits if you set the options correctly.

Quick answer: use the database queue driver, then add one cPanel cron job that runs every minute: cd /home/USERNAME/app && /opt/cpanel/ea-php83/root/usr/bin/php artisan queue:work --stop-when-empty --max-time=50 --tries=3 --timeout=45 >/dev/null 2>&1 . The worker processes what is waiting, exits, and cron starts a fresh one the next minute (add flock as shown below so two never overlap). If schedule:run is already in your crontab, schedule the same command with ->everyMinute()->withoutOverlapping(5) instead.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.