4 years ago

Database Queue on Shared Hosting

Posted 4 years ago by davidrushton

Sometimes it's necessary to host a Laravel app on shared / cPanel hosting, but we recently ran in to an issue where using the queue was necessary.

Given that Beanstalkd, SQS and Redis weren't possible, we looked into using the database driver and a the scheduler cron job.

Thought I'd post the solution we used here in case it's helpful for anyone else. The code is on Gist at https://gist.github.com/davidrushton/b7229df4c73372402fc1 and I wrote a quick blog post at http://papertank.co.uk/blog/903/setup-laravel-queue-on-shared-hosting/.

Thanks to inspiration from https://gist.github.com/mauris/11375869, the scheduler job which runs every 5 minutes spawns a new queue:listen process and checks a local file with the process ID to see if it needs re-created or not.

Please sign in or create an account to participate in this conversation.