How to fix cron readiness check issues in Magento 2
If you experience issues with cron readiness in Magento 2, the following article may be helpful. We describe several symptoms of the “ailment” and shed light on how to fix the problem. More useful tips are gathered in our Cookbook.
Table of contents
The issue
Cron issues usually have several symptoms. Firstly, you may spot an error message about $HTTP_RAW_POST_DATA, even though this PHP setting is set correctly. Secondly, no PHP version is displayed at the PHP readiness check. Thirdly, you may see an error message in the admin, informing you about invalid indexers and proposing to check whether Magento cron job is running.
The solution
To fix the problem, you have to check whether cron is currently running or not. At the same time, it is necessary to see if it’s set up correctly. To do both tasks, you have to log in as a Magento file system owner to your Magento 2 server. If the following file exists, cron has already run successfully:
1 |
ls -al <magento_root>/var/.setup_cronjob_status |
If you cannot find this file, it means that you haven’t yet installed Magento. If it is installed, cron isn’t running.
Now, you have to get more detail about cron. Use the following command (you should have root privileges to do that):
1 |
crontab -u <Magento file system owner name> -l |
The system will inform you if there is no crontab for the user. As for the crontab, it provides the following information:
- PHP binary(s).
- Magento cron scripts and paths to them;
- Location of cron logs.
Set up crontab
You have to set up your Magento 2 crontab if it is not configured correctly. See the official Magento documentation to verify whether it suits the requirements or not:
Correct PHP binary
Chances are your cron job uses an inappropriate PHP binary. If the binary differs from the web server plug-in, it may lead to PHP settings errors.
Note that PHP settings for both the PHP command line and the PHP web server plug-in should be identical! See the official Magento 2 documentation:
Discover cron errors
To discover more information about cron readiness check issues in Magento 2, run cron commands manually. Run cron at least twice per job: to queue it and then to execute. Note that commands might display helpful error messages that shed light upon the existing cron issues. See the official documentation we’ve just mentioned:
For further information, follow this link: