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

pierrem's avatar

php artisan queue:work

Hi all,

I'm on a a shared hosting solution (ovh) and setup a queue which worked fine on local but not on shared. So I tried several solutions :


Artisan::call('queue:work',['--once' => true]);

works but it is synchroneous whereas I would like to run it background.


exec('php artisan view:clear --once > /dev/null 2>&1 & echo $!',$test);

returns error syntax error, unexpected T_FUNCTION in ...

the given line being : $app->bind('path.public', function() { return DIR.'../www/'; });

So when it comes to the cron :


protected function schedule(Schedule $schedule)
    {
        $schedule->job(new CronHourly)->hourly();
        $schedule->exec('php /home/gerantimcm/artisan queue:work --once > /dev/null 2>&1')->hourly();
        $this->scheduleRunsHourly($schedule);
    }

protected function scheduleRunsHourly(Schedule $schedule) { foreach ($schedule->events() as $event) { $event->expression = substr_replace($event->expression, '*', 0, 1); } }

the CronHourly is executed but no mail is sent.

I tried also the following


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

but not working.

Any idea ?

0 likes
3 replies
pierrem's avatar
pierrem
OP
Best Answer
Level 1

ok I found it using some thread I realize I add tospecify the full path of php. Default php version was 4 which is not compatible with laravel...

Specifying the path to php 7 resolve everything !

hope it might help some in the future...

jeFFF's avatar

Hello @pierrem, I also have some trouble setting thins up on OVH. Do you know how long last the process you launched with the daemon ? Did you manage to run it more frequently than an hour ?

pierrem's avatar

hi JeFFF,

What's your hosting plan on OVH ?

I was on shared hosting, moved to inmotionhosting (which is very expensive for what it is) and finally made a move back to OVH on dedicated VPS solution.

On shared hosting, you can't setup a supervisor and crontab can only called on a hourly basis...

On InmotionHosting, shared hosting enables cron every minute

I upgraded to Inmotion VPShosting at first but it is managed solutions which are expensive and you can't change most of the config.

So in the end I moved back to OVH dedicated hosting which in fact is pretty cheap. The only thing you have to know is that nothing is setup ! You have to setup everything by your own apache2, mysql, php, ssl, phpmyadmin, postfix/dovecot (including spf, dkim)... It is really a pain though you can find tutorials and once done you can setup supervisor and everything becomes more easy !

The script time execution is pretty long can go up to five minutes now.

Please or to participate in this conversation.