ARTICLE AD BOX
I have a Laravel 12.39 project (on PHP 8.3) on a shared hosting with cPanel access, and in the cron section, I have the following setting to run artisan schedule:run, but it isn't working. This was an upgrade from the Laravel 10 project, where the server crons were the same and worked.
* * * * * /usr/local/bin/php /home/my-project/public_html/artisan schedule:run > /dev/null 2>&1In my app/Console/Kernel.php class, I have the following method and command:
<?php namespace App\Console; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; class Kernel extends ConsoleKernel { /** * Define the application's command schedule. */ protected function schedule(Schedule $schedule): void { // Continuous // Queue $schedule->command('queue:work --tries=3')->runInBackground()->withoutOverlapping()->evenInMaintenanceMode()->everyMinute(); if(app()->isProduction()) { // Every five minutes // Clear views $schedule->command('view:clear', ['--quiet'])->withoutOverlapping()->everyFiveMinutes(); } } /** * Register the commands for the application. */ protected function commands(): void { $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } }Is the above cron set correctly at the cPanel, or is it an issue in my Laravel 12 code that I must be calling? As mentioned above, I´ve upgraded from Laravel 10 (where it was running) to Laravel 12.39, but it isn´t running.
Thanks in advance for any help on this issue.
2,0213 gold badges21 silver badges32 bronze badges
2
