Get a free website with any plan

See how
APPLICATIONS

Setting up Moodle's cron job

Last updated

IN SHORT

A Moodle cron job processes scheduled tasks, notifications, and grade calculations on Flashcloud hosting. Set it up in cPanel under Cron Jobs to run every minute using the PHP command line. The CLI binary path must match your site's specific PHP version for tasks to execute properly.

Moodle relies on a cron job to process message queues, send notifications, calculate grades, and run scheduled tasks. If those things aren't happening, cron isn't running. The fix: add a cron job that calls Moodle's cron.php on a schedule, most commonly every minute.

Moodle itself recommends running cron at least every minute for time-sensitive tasks (message notifications, calendar reminders) even though most individual scheduled tasks run less often.

Setting up the cron job

Cron Jobs is a cPanel tool, found under the Advanced section. Log in to cPanel (see accessing cPanel for how to get there) and open Cron Jobs. Add a new job with:

  • Schedule: every minute (* * * * *)
  • Command: a PHP CLI call to your Moodle install's cron.php

The command looks like this, adjusted for your actual install path and PHP binary:

/usr/local/bin/php /home/USERNAME/public_html/moodle/admin/cli/cron.php

Replace USERNAME with your cPanel username and adjust the path if Moodle lives in a subdirectory or a different docroot. If you installed Moodle via Softaculous rather than by hand, check the install summary for the exact path, since Softaculous sometimes nests the app one level deeper than expected.

Matching the PHP version and CLI binary

Moodle version requirements are specific about PHP versions, and the CLI binary needs to match the PHP version your site actually runs, rather than the default php binary on the server. Set the domain's PHP version from the PHP Version tile first, then confirm the matching CLI binary path in cPanel's MultiPHP Manager or Select PHP Version tool for the version selected.

If cron runs but nothing happens, the most common cause is a mismatched or missing PHP binary path rather than anything wrong with Moodle's configuration.

Confirming it's working

Moodle logs each cron run. As an admin, go to Site administration → Reports → Task logs in Moodle's own UI and confirm entries are appearing at roughly the interval you set. A gap of more than a few minutes with no entries means the cron job isn't firing or is failing before it reaches Moodle's task scheduler.

You can also test the command by hand over SSH (there's no Terminal tool in cPanel, so use an SSH client) to see any PHP errors directly, rather than waiting on the next scheduled run.

Performance under load

Large Moodle sites with many scheduled tasks (backups, grade recalculation) can make individual cron runs take longer than a minute. Moodle handles overlapping runs by skipping a new invocation if the previous one hasn't finished, so this is usually self-correcting rather than something that stacks up. If cron runs consistently take a long time, the underlying constraint is CPU and memory available to the PHP process, the same resources covered in how we make your site fast.

If you need cPanel for anything else

If you need to inspect PHP error logs, adjust upload limits in MultiPHP INI Editor, or check the exact PHP binary path for your version, that's also in cPanel. See accessing cPanel for how to get there and what else lives in there versus in the portal.

When to contact support

If the cron job is set up correctly, points at the right PHP binary, and still isn't reaching Moodle's task scheduler, open a ticket from Support in the portal. Include the exact cron command you're using and a timestamp of a recent expected run, so our team can check server-side logs and confirm whether the job executed at all.

Common questions

How often should I run Moodle cron?

Run it every minute. Moodle recommends this schedule for time-sensitive tasks like calendar reminders and notifications.

Why is my cron job running but nothing is happening?

Your PHP binary path likely does not match the PHP version your site uses. Check your domain's PHP version in cPanel and update the cron command with the matching CLI binary path.

How do I know if Moodle cron is working?

Check your task logs in Moodle. Go to Site administration, Reports, and Task logs to verify entries appear at your set interval. You can also run the command manually over SSH to spot any PHP errors.

What happens if a Moodle cron job takes longer than a minute?

Moodle skips the next scheduled run until the active one finishes. Overlapping jobs will not stack up, though long run times indicate your PHP process needs more CPU and memory.

CAN'T FIND IT?

Real humans answer fast.

Hosting with us? Open a ticket and a real person replies - no scripts, no upsells. Still choosing a host? The same team is included with every plan, from day one.