Skip to content
Server and cPanel3 min read

Cron job not running? How to diagnose and fix it

Could not open input file: cron.php

Short answer

Most cron jobs that seem dead are actually running and failing silently: a relative path, a PHP version different from the site's, an unescaped %, or output thrown away to /dev/null. Use full paths, redirect output to a log file, and read that log after the first scheduled run.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. Causes
  2. How to fix it
  3. WordPress scheduled tasks
  4. Prevention
  5. On ArabyHost

Cron runs commands in an environment quite different from your terminal: it starts in your home folder, has a minimal PATH and skips your personal shell settings. That’s why a command works by hand and fails on schedule. A message like Could not open input file: cron.php, arriving in cron’s email or log, means PHP couldn’t find the file because the path was relative.

Causes

  • Relative path: php cron.php instead of /home/cpuser/public_html/cron.php.
  • Different PHP version: php in cron may be the server’s default version rather than the one your site uses, causing undefined functions or PHP fatal errors.
  • The % character: cron treats it as a newline, so commands like date +%F break unless written as \%.
  • Hidden output: >/dev/null 2>&1 throws every error message away.
  • Wrong schedule: the five time fields are malformed, or you expect local time while cron uses the server’s.
  • Permissions: a shell script without the execute bit, or a script writing to a folder it can’t write to (Permission denied).
  • Working-directory assumptions: the script includes files with relative paths like include 'config.php'.
  • Overlapping runs: a long job starts again before the previous run finishes and they collide.

How to fix it

1. Use full paths and a log file

In cPanel → Advanced → Cron Jobs → Add New Cron Job, pick the schedule and enter:

*/15 * * * * /usr/local/bin/php /home/cpuser/public_html/cron.php >> /home/cpuser/cron.log 2>&1

To pin a specific PHP version, call its binary instead of /usr/local/bin/php:

*/15 * * * * /opt/cpanel/ea-php83/root/usr/bin/php /home/cpuser/public_html/cron.php >> /home/cpuser/cron.log 2>&1

For Laravel, change into the project folder first (see the Laravel deploy guide):

* * * * * cd /home/cpuser/app && /opt/cpanel/ea-php83/root/usr/bin/php artisan schedule:run >> /home/cpuser/schedule.log 2>&1

2. Run the same command by hand

If your plan includes SSH, run the command exactly as written (without the five time fields) from your home folder:

cd ~
/opt/cpanel/ea-php83/root/usr/bin/php -v
/opt/cpanel/ea-php83/root/usr/bin/php /home/cpuser/public_html/cron.php

3. Read the log after the scheduled time

tail -n 50 /home/cpuser/cron.log

If the file was never created, the job never started: check the schedule with the cron generator. If it contains PHP errors, fix them like any other bug.

4. Escape % and prevent overlaps

0 3 * * * /bin/echo "started $(date +\%F)" >> /home/cpuser/cron.log
* * * * * /usr/bin/flock -n /home/cpuser/job.lock /usr/local/bin/php /home/cpuser/public_html/cron.php >> /home/cpuser/cron.log 2>&1

flock -n skips a new run while the previous one still holds the lock.

WordPress scheduled tasks

WP-Cron isn’t real cron; it runs when someone visits the site. If it’s WordPress’s scheduled posts or tasks that lag, see WP-Cron not working.

Prevention

  • Always use full paths and give each job its own log.
  • Don’t schedule a job more often than it needs; every run uses your account’s resources.
  • Re-test jobs whenever you change the PHP version.
  • Check logs now and then and trim old ones so they don’t grow without limit.

On ArabyHost

You add jobs on the Cron Jobs page in cPanel, which opens with one click from the Araby Panel. The available PHP versions are 8.1, 8.2 and 8.3, with binaries under /opt/cpanel/ea-php81, ea-php82 and ea-php83. On the AI/Developer plans you can test commands over SSH, and cron is also how background workers such as bots are kept alive and restarted if they stop, as shown in the cron jobs guide. Prefer a log file over the Cron Email option for frequent jobs, because outgoing email is capped per hour per domain. If the cause still isn’t clear, the Araby AI assistant reads your error logs and explains the fix.

FAQ

How do I know whether my cron job runs at all?

Append an output redirect such as >> /home/cpuser/cron.log 2>&1 to the command and wait for the scheduled time. If the file appears, the job started, and its contents show why it failed, if it did.

Why does the command work in the terminal but not in cron?

Cron runs commands in a minimal environment: it starts in your home folder, has a short PATH and doesn't read .bashrc. Write full paths, and cd into the project folder first when the script expects it.

Which time zone do cron jobs use?

The server's, not your computer's. Run date on the server to see it and set the hour fields in your cron line accordingly.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.