Home > OS >  Laravel 7: Cron jobs for task scheduler in Cpanel not working
Laravel 7: Cron jobs for task scheduler in Cpanel not working

Time:07-05

I'm using Namecheap Hosting. And my files are in a subdomain. I've added a task scheduler in Kernel.php file and add cron jobs in hosting. But it's not working. When I manually run schedule command it works perfectly. Can anyone please see the below code and details and tell me what am I missing?

Kerner.php file:

protected function schedule(Schedule $schedule)
    {
        $schedule->command('add:earnLeave')
        ->everyMinute()
        ->timezone('Asia/Dhaka');
    }

Cron Command:

/usr/local/bin/php /https://subdomain.maindomain.com/php artisan schedule:run >> /dev/null 2>&1

and in my hosting the minimum run time is every five minutes */5 * * * * and my task scheduler will run once on the last day of the month. For testing purposes, I set it to every minute. Should I have to keep this run time equal to cron jobs?

What should I do now?

CodePudding user response:

Domain name no needed.

/usr/local/bin/php /home/username/public_html/laravelrootfolder/artisan schedule:run >> /dev/null 2>&1

CodePudding user response:

I have solved this problem myself. I use /usr/bin/php instead of usr/local/bin/php And also proc_open was disabled. After enabling it, now it's working fine.

  • Related