0

My problem is Magento 2 doesn’t automatically index as I expect from the cron job. I currently have to SSH in and re-index using php bin/magento indexer:reindex , which is fine for me but not for my customers

The server (WHM cPanel setup, jailed shell) is my own which I am sharing between several of my customers. So I have root login but will need to keep the customers ‘jailed’. The server is almost new with only 1 other WordPress site. I am hoping to put several Magento 2 installs on it.

I suspect the cron job is running but something else is stopping the reindexing from happening.

There are no errors (empty) in magento.cron.log or setup.cron.log

In update.cron.log I'm getting:

Notice: Undefined variable: nonWritablePaths in /home/gabitieartificia/public_html/update/app/code/Magento/Update/CronReadinessCheck.php on line 86 Warning: implode(): Invalid arguments passed in /home/gabitieartificia/public_html/update/app/code/Magento/Update/CronReadinessCheck.php on line 86 update-cron: Please check var/log/update.log for execution summary.

In debug.log I'm getting this error:

[2016-06-12 09:19:07] main.DEBUG: cache_invalidate: {"method":"POST","url":"ht tp://gabitie.artificialart.co.uk/admin_ejiyo5/admin/index/index/key/46b3c13a698e28d113fd7d912659ff6cc5859d09833e8cf81e3448cb01ff357f/","invalidateInfo":{"tags":["BACKEND_MAINMENU"],"mode":"matchingAnyTag"},"is_exception":false} []

In update.log I'm getting this error:

[2016-06-10 11:28:03] update-cron.ERROR: Cron readiness check failure! Found following non-writable paths [] []

And in the cPanel error log I'm getting this error:

[Sun Jun 12 10:19:09.601340 2016] [access_compat:error] [pid 34328] [client 130.185.144.89:50199] AH01797: client denied by server configuration: /home/gabitieartificia/public_html/app/etc/config.php

I don’t know if all these errors relate to my re-indexing problem. I have been Googling permutations of these error messages for the last few days trying to find a solution to no avail.

Im sure my paths to php.ini and the binary are correct.

When I run the commands from a command line as root from the top directory they work fine with no errors at all, but it still doesn’t re-index

Ie this works fine:

sudo –u gabitieartificia /usr/local/bin/php -c /usr/local/lib/php.ini /home/gabitieartificia/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/gabitieartificia/public_html/var/log/magento.cron.log

phpinfo = http://gabitie.artificialart.co.uk/phpinfo.php

crontab contents =

 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/gabitieartificia/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/gabitieartificia/public_html/var/log/magento.cron.log
 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/gabitieartificia/public_html/update/cron.php >> /home/gabitieartificia/public_html/var/log/update.cron.log
 * * * * /usr/local/bin/php -c /usr/local/lib/php.ini /home/gabitieartificia/public_html/bin/magento setup:cron:run >> /home/gabitieartificia/public_html/var/log/setup.cron.log

I have even tried setting up a second copy of Magento 2 on the same server and putting all folders to chmod 777 to prove if it is permissions related, but that didn’t work either. It still wasn’t re-indexing.

Any help/insight anyone can provide will be hugely appreciated.

2 Answers 2

2

Looks like a permission problem. Please look here http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html

Or try to execute in magento dir:

chown :www-data . -R find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var vendor pub/static pub/media app/etc -type d -exec chmod g+w {} \; && chmod u+x bin/magento
0

Sorry for the delayed response

I eventually solved this by adding 2 lines to the following file

in update/app/code/Magento/Update/CronReadinessCheck.php

public function runReadinessCheck()

$resultJsonRawData = ['readiness_checks' => []];
$success = true;

$permissionInfo = $this->checkPermissionsRecursively();
$nonWritablePaths = $permissionInfo->getNonWritablePaths();      <------+THIS LINE
$nonReadablePaths = $permissionInfo->getNonReadablePaths();      <------+THIS LINE

as detailed by bramklg & commcad on https://github.com/magento/magento2/issues/4911

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.