Cron Failures
Problem
The system is attempting to invoke the system cron correctly, but the cron job is not completing the run.
You may not receive the daily cron digest email or see a warning at Configuration () > System Health or Utilities > Automation Status.
Cause
Cron tasks can fail for many reasons. Check the exact error to determine the cause.
Troubleshooting
To troubleshoot this issue, first perform the steps in Check the Cron Job Status to determine the exact error.
To find additional information, view previous errors in the Activity Log, visit the cron.php
file in your browser, or use the command line (below).
Activity Log
Examine the results of previous cron runs in the Activity Log at Configuration () > System Logs.
- Make sure that you see entries beginning with
Cron Job
each day. - The final entry every day should be
Cron Job: Completed
.
If you see no cron job entries, you have not configured your automation cron job correctly.
Browser
- Executing the
cron.php
file from the browser is not possible if the/crons
directory is not inside a web-accessible directory. - Limitations for executing a PHP script in a browser (for example, timeouts) will apply.
- We recommend using the command line instead.
To do this:
Make certain that you have enabled Display Errors in the Other tab at Configuration () > System Settings > General Settings.
For more information, see Enable Error Reporting.Visit the
cron.php
file in your browser. For example:http://www.example.com/whmcs/crons/cron.php
View the results in the Activity Log at Configuration () > System Logs.
Command Line
The cron.php
script includes an option to increase output verbosity. This helps to identify errors when they occur.
To use this:
Make certain that you have enabled Display Errors in the Other tab at Configuration () > System Settings > General Settings.
For more information, see Enable Error Reporting.Go to Utilities > Automation Status.
Click on the Cron Status error:
Copy the Cron Command command by clicking the Copy icon next to the command.
On your server’s command line, run the following command to ensure that you have enabled
display_errors
in your PHP environment:php -i | grep display_errors
If
display_errors
is enabled, this will return the following string:display_errors => STDOUT => STDOUT
Paste the command into the terminal. At the end of the command, add the following command and options:
all -F -vvv
- The
all
command will execute all the tasks. - The
-F
option forcibly executes all the tasks, even if some of the daily tasks have already run. - The
-vvv
option sets the output verbosity level to the maximum verbosity.
This will produce a command like the following example:
php -q /home/example/public_html/whmcs/crons/cron.php all -F -vvv
- The
Run the command. The
cron.php
script will run all of the tasks and return output that ends with a green[OK] Completed
message.Do not do this more than once in a given 24-hour period.Examine the errors in the output to determine the cause of your issue.
Solution
The errors that you find determine the solution.
- For more information, search for the specific error in our Troubleshooting documentation.
- For additional help, contact WHMCS Technical Support. Include the full output from the steps above when you open your ticket.
Last modified: November 19, 2024