Cron job not running
Diagnose a cron job that doesn’t seem to run: wrong schedule, relative paths, PHP binary, permissions, silent errors and overlapping runs.
On this page
Does this match what you’re seeing?
- A scheduled task never seems to happen
- The script works in a browser but not from cron
- Cron emails show errors
1. Capture output
Change the command so it writes everything to a log:
/usr/local/bin/php /home/USERNAME/path/to/script.php >> /home/USERNAME/cron-debug.log 2>&1Wait for the next scheduled time and read the log. An empty log after the time has passed means cron didn’t run it; errors mean it ran and failed.
2. It didn’t run
- Schedule: check the five fields.
* 3 * * *runs every minute from 03:00 to 03:59, not once. Cron schedule syntax explained (with examples) - Server time zone differs from UK time.
- The job was saved? Confirm it’s listed in Advanced Features › Cronjobs.
3. It ran and failed
| Log shows | Fix |
|---|---|
No such file or directory | Use full absolute paths for the script and anything it includes |
php: command not found | Use the full PHP path Running PHP scripts from cron: paths, output and common mistakes |
Failed opening required | Build include paths from __DIR__ |
Permission denied | Script and folders readable (644/755) |
| Wrong PHP version errors | Cron may use a different PHP version than the website; call the specific binary |
4. It runs but does nothing
- The script depends on
$_SERVERor$_GETvalues that don’t exist in cron - It exits early because a previous run’s lock file was never removed
- Output is suppressed with
>/dev/null, hiding the error
5. It runs too often or piles up
Add locking so overlapping runs exit. Running PHP scripts from cron: paths, output and common mistakes
Remove the debug log redirect when finished.
Prefer to follow along?
- Schedule a task with a cron job
Intermediate · 20 min
Common questions
Why isn’t my cron job running?
Usually the path is wrong. Cron doesn’t know your shell’s settings, so use absolute paths for both the PHP binary and your script. Redirect the output to a log file so you can see what actually happened.
Spotted something out of date or unclear? Tell us and we’ll fix it.