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>&1
Wait 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 then 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.