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

AydenWH's avatar

Cron job is running but script is not working

I uploaded my script into my server and apply the cron job as shown in the image below.

From the image, it shows that my cron job will be running every minute. But actually is it not, it runs every 5 minutes. I wonder why. Refer to the image below.

It does not matter the cron job runs every minute or every 5 minutes, the script seems not working from the cron job but it works whenever I call it manually.

App\Console\Kernel.php

<?php

namespace App\Console;

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

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        \App\Console\Commands\Reminder::class
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('reminder:renewal')->everyMinute();
    }

    /**
     * Register the Closure based commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        require base_path('routes/console.php');
    }
}

App\Console\Commands\Reminder.php

<?php

namespace App\Console\Commands;

use DB;
use Illuminate\Console\Command;

class Reminder extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'reminder:renewal';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Renewal Server, Web Hosting and Domain Name';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        DB::table('test')->insert(['name' => 'Testing']);
    }
}

I can't troubleshoot where is the problem. Therefore, I hope anyone can point out what's the problem behind the scene.

Thanks.

0 likes
2 replies
MNoman's avatar
MNoman
Best Answer
Level 5

1 * * * * means that the command will run at the first minute of each hour, use * * * * * to run command every minute

if you are running Laravel from cPanel account then you may try to specify full PHP path like:

/usr/local/bin/php ~/webminder/artisan schedule:run >> /dev/null 2>&1

2 likes
AydenWH's avatar

@MNoman

Woah, you saved my day.

But I never use ~/webminder/artisan because the folder need to be start from the beginning of the root.

Thanks! It is working now.

Please or to participate in this conversation.