A cron job that never seems to run is usually running, but failing: the command uses the wrong PHP version, a relative path, or an output redirect hides the error. This guide shows how to make cron jobs visible, and the command formats that work on cPanel hosting. For creating jobs, see cPanel cron jobs.
Before you start
- Open cPanel → Advanced → Cron Jobs and look at the existing job's command and schedule.
- Terminal access helps a lot: if the command fails in Terminal, it will fail in cron too.
Step 1: see the output
Cron sends a command's output by email to the address in Cron Email at the top of the Cron Jobs page. If your command ends with >/dev/null 2>&1, all output and errors are thrown away. For troubleshooting, write them to a log instead:
/usr/local/bin/php /home/cpuser/public_html/script.php >> /home/cpuser/cron.log 2>&1Wait for the next run, then open cron.log in File Manager. Remove logging once it works, or the file keeps growing.
Step 2: use the right PHP binary
| Binary | Use |
|---|---|
/usr/local/bin/php | Server default PHP CLI |
/opt/cpanel/ea-php83/root/usr/bin/php | A specific EasyApache PHP version (here 8.3) |
/opt/alt/php83/usr/bin/php | A specific CloudLinux alt-php version |
Use the same version as the website (shown in MultiPHP Manager). Many "works in browser, fails in cron" problems come from the CLI using an older PHP.
Step 3: use absolute paths
- Cron starts in your home directory, not in the script's folder. Use full paths like
/home/cpuser/public_html/.... - If the script includes files with relative paths, change into its folder first:
cd /home/cpuser/public_html/app && /usr/local/bin/php artisan schedule:run
Step 4: check the schedule syntax
| Schedule | Minute Hour Day Month Weekday |
|---|---|
| Every 15 minutes | */15 * * * * |
| Every day at 03:30 | 30 3 * * * |
| Mondays at 08:00 | 0 8 * * 1 |
| First day of the month at midnight | 0 0 1 * * |
Times use the server's time zone, which may differ from yours. Check with date in Terminal.
Tip: Avoid running heavy jobs every minute. Frequent jobs count toward your CloudLinux limits; see resource usage.
URL-based cron jobs
Some apps give you a URL to call. Use curl or wget:
curl -fsS "https://example.com/cron.php?key=SECRET" >/dev/nullQuote URLs containing & or ?. If the site is behind a password (Directory Privacy) or a firewall challenge, the request fails; call the PHP file directly with the CLI instead.
Common errors in the log
Could not open input file: wrong path to the script.Permission denied: you tried to execute a file directly withoutphpin front, or it lacks execute permission./bin/sh: ... command not found: a tool is not in cron's minimal PATH; use its full path.Allowed memory size exhausted: add-d memory_limit=512Mafter the PHP binary.
