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

JustInCase's avatar

Task Scheduler Not Working

I wanted to use laravel task scheduler in my project , i hosted it in shared hosting

My Cpanel cronjob command : cd /home/"my cpanel username"/public_html/core/ && php artisan schedule:run >> /dev/null 2>&1

now in core folder was the laravel app , i tested it in localhost its working fine my scheduler command was :

    $schedule->call(function () {
            $settings = Setting::get();
            foreach ($settings as $value) {
                   $result[$value['name']] = $value['data'];
              }
   $this->datas = $result;
       User::where('id', '>', 0)->update(['rollFaucet_left' => $this->datas['rollfaucet_limit'], 'claims_left' => 								 
   $this->datas['faucet_limit']]);
       return "Done";
    })->everyMinute();

OK , Now i also added my email to recieve the output to check if it is working

but unfortunately its not working , i did anything wrong or is there any solution for it

0 likes
7 replies
Nakov's avatar

Do you need to change the directory, or you can just leave the cron job to execute the PHP script witin your folder?

So this instead:

/home/"my cpanel username"/public_html/core/php artisan schedule:run >> /dev/null 2>&1

Also you can add Log::info('Testing'); in your Kernel.php file above the $schedule->call calls, and make sure that the line is getting printed in the log, that way you'll know if your scheduler is working. Nothing else seems wrong from a first look.

JustInCase's avatar

@Nakov It Didn't work ,

     $schedule->call(function () {
            Log::info("SDONE ");
    })->everyFiveMinutes();

i wrote this code , and my cronjob interval was 5 minutes ( as my hosting don't support every minute)

Nakov's avatar

@mrphp put it above the scheduler:

protected function schedule(Schedule $schedule)
{
      Log::info("SDONE ");

   $schedule->call(function () {

    })->everyFiveMinutes();
}

if it didn't worked, then it means that your cPanel configuration is wrong, nothing to do with Laravel. Make sure that the path to the project is correct, and that the user has permissions to run the php script.

JustInCase's avatar

@Nakov It didn't log anything , i thinks its because of cronjob intervals every set to 5 minutes?

Nakov's avatar

@mrphp if it is set to 5 minutes, you will get a log info every 5 minutes, if you are not getting any, then it means that you cron job is not reaching the directory, or as I said above the user set by the cPanel to run the php script does not have access to do so. I can't explain it more. And I can't try what you are doing. But Laravel is not the issue in this case, it is your cPanel.

Please or to participate in this conversation.