Cron stopped due to misconfigured or missing OpCache settings
This article provides a solution for when cron stops working due to missing or misconfigured OpCache settings.
Affected products and versions
Adobe Commerce on cloud infrastructure, all supported versions.
Issue
The cron stopped working.
Cause
The OpCache module was updated to a newer version which introduced a GraphQL plugin that rewrites the env.php
in runtime and could override the cron setting, which may have caused the issue. The OpCache configuration needs to be updated in order to avoid any issues with the env.php file
, and that was solved in version 2002.1.13 of the ECE Tools package.
Solution
Option 1: Run the following in the command-line tool:
bin/magento cron:run
A message might display that the cron is disabled.
Option 2: Open the app/etc/env.php
file - if you see the below, then the cron was disabled manually, was not re-enabled due to a failed deployment, or the issue was related to the OpCache settings.
'cron' =>
array (
'enabled' => 0,
),
- If the cron is disabled, run this command to re-enable the cron:
vendor/bin/ece-tools cron:enable
- Make sure that you are on the latest version of ECE Tools. If you are not, upgrade (or skip to item 3). To check your existing version, run this command:
composer show magento/ece-tools
- If you are already on the latest version of ECE Tools, check for the presence of the
op-exclude.txt
file. To do so, run this command:ls op-exclude.txt
.
If this file is not present, add https://github.com/magento/magento-cloud/blob/master/op-exclude.txt to your repo, then commit the change and redeploy. - Without having to upgrade ECE Tools, you can also just add/modify https://github.com/magento/magento-cloud/blob/master/op-exclude.txt in your repo, then commit the change and redeploy.