Skip to content

Step 6 of 10

Run the Laravel scheduler with cPanel cron

Laravel needs one cron job, and it then decides which of your tasks are due. The usual reason it fails on shared hosting is the wrong PHP version.

The cron job

In cPanel → Cron Jobs, add one entry with the full path to PHP:

* * * * * cd /home/cpaneluser/laravel-app && /opt/cpanel/ea-php83/root/usr/bin/php artisan schedule:run >> /dev/null 2>&1

Change 83 to your PHP version. On CloudLinux servers the path is usually /opt/alt/php83/usr/bin/php. The config generator writes the line for you, and these cron examples explain each schedule.

Why plain "php" often fails

Your website and cron can use different PHP versions. With plain php, cron may run an older version, and Laravel stops with "Your Composer dependencies require a PHP version >= 8.2". Use the full path. To check a path in the Terminal:

/opt/cpanel/ea-php83/root/usr/bin/php -v

Define your tasks

In Laravel 11 and 12, tasks go in routes/console.php:

use Illuminate\Support\Facades\Schedule;

Schedule::command('reports:send')->dailyAt('08:00');
Schedule::command('backup:run')->daily();

If your host limits cron

If cron can only run every 5 or 15 minutes, use that interval. Laravel only checks tasks when cron runs, so:

  • ->dailyAt('08:03') may never run with a 5-minute cron, because no run lands on 08:03. Use times like 08:00 or 08:05.
  • ->everyMinute() tasks run once per cron run, not every minute.
To get emails with the output while testing, set the email box at the top of the Cron Jobs page and remove >> /dev/null 2>&1. Put it back afterwards.

Frequently asked questions

How do I know the cron job is running?

Remove >> /dev/null 2>&1 for a moment so cron emails you the output, or write the output to a file with >> storage/logs/cron.log 2>&1.

Do I need a separate cron job for each task?

No. One schedule:run entry runs them all.

Get new articles in your inbox

Practical tutorials and deep dives, about once a week. No spam, unsubscribe anytime.

Privacy policy

Add DEV Talk to your Home Screen

  1. 1 Tap the Share button in Safari's toolbar.
  2. 2 Scroll down and tap Add to Home Screen.
  3. 3 Tap Add. Open it from the Home Screen to read like an app and to turn on notifications with the bell.

We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.