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

mvnobrega's avatar

How to enable php artisan queue:work on shared hosting?

I have read several topics and articles on the internet on the subject, but this is my first contact with Cron Jobs and I am unable to make it work. I need to keep the php artisan queue: work running. In my hosting it has this:

https://prnt.sc/uwhij5

I've tried it in a few ways, but the two most recent were these:

https://prnt.sc/uwhj69

This does not seem to work, as I am not receiving an account verification email.

Can someone help me ?

0 likes
2 replies
mvnobrega's avatar
mvnobrega
OP
Best Answer
Level 3

My shared hosting é Hostinger, and i solved it like this: php /home/u216892564/public_html/artisan queue:work --daemon

LucasHayashi-71951506's avatar

Olá, vou ensinar como resolver este problema em 2025 com o Laravel 11 no shared hosting da Hostinger.

Antes de ir para o Cron Jobs é necessário:

1 - Criar o arquivo Kernel.php (app\Console\Kernel.php)

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    protected function schedule(Schedule $schedule): void {}

    protected function commands(): void
    {
        $this->load(__DIR__ . '/Commands');

        require base_path('routes/console.php');
    }
}

2 - Adicionar o seguinte código no console.php (routes\console.php)

<?php

use Illuminate\Support\Facades\Artisan;

Artisan::command('queue:work-empty', function () {
    $this->info('Starting the queue worker...');
    Artisan::call('queue:work', ['--stop-when-empty' => true]);
    $this->info('Queue worker stopped as queue is empty.');
})->purpose('Run the queue worker and stop when the queue is empty');

No hPanel -> Cron Jobs

Colar o seguinte trecho no input:

domains/[SEU_DOMINIO]/public_html/[SUA_APLICACAO_LARAVEL]/artisan queue:work-empty

Obs: As demais informações, deixei o menor tempo possível (* * * * *)

Ao clicar em "Ver Saída", você irá obter a seguinte mensagem:

Starting the queue worker... Queue worker stopped as queue is empty.

Espero que tenha ajudado, até a próxima!

Não consegui adicionar as imagens porque foi meu primeiro dia :(

Please or to participate in this conversation.