Every minute my Cron Jobs run, it inserts a line into the ../error_log:
[11-Sep-2017 07:47:01 America/New_York] PHP Warning: file_put_contents(<magento dir>/var/.update_cronjob_status): failed to open stream: Permission denied in <magento dir>/update/app/code/Magento/Update/CronReadinessCheck.php on line 91
The .update_cronjob_status file exists in the directory and with permissions 0644. This is a fresh 2.1.8 installation and wasn't an upgrade from a previous.
My Jobs are as follows
* * * * * /usr/local/bin/php <magento dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /usr/bin/php <magento dir>/var/log/magento.cron.log * * * * * /usr/local/bin/php <magento dir>/update/cron.php >> <magento dir>/var/log/update.cron.log * * * * * /usr/local/bin/php <magento dir>/bin/magento setup:cron:run >> <magento dir>/var/log/setup.cron.log 0 2 * * 2,4 /usr/local/bin/php <magento dir>/bin/magento indexer:reindex
I tried Googling for others having this same issue and I didn't see any concrete resolutions. There was one guy who created his own version of the CronReadinessCheck.php but I didn't want to try and port that work around into a different version of Magento.
Details about the server:
2.5GB Script Memory
Hosted on GoDaddy with CentOS
Does anyone know how to fix this?
Solved! Go to Solution.
You mention the permission. What the user and group ownership of the var folder? And what user does the webserver run as?
The var folder is 755 -- it runs as a separate user from the root users.
Your questions put me on the right path and I think I figured out the problem.
I had to use the SSH command below, replacing user with the user the cron jobs run under.
chown user:user .update_cronjob_status