Magento 2 : Error setting up cron job

ERROR SETTING UP CRON JOB

Magento 2 Error setting up cron job

Today we are going to talk about how to resolve the following error when setting up cron job in Magento 2 when try to schedule or run update/cron.php

PHP Warning: require_once(/chroot/home/a3c706ea/xyz/html/update/vendor/autoload.php): failed to open stream: No such file or directory in /chroot/home/a3c706ea/xyz/html/update/app/bootstrap.php on line 15
PHP Fatal error: require_once(): Failed opening required '/chroot/home/a3c706ea/xyz/html/update/vendor/autoload.php' (include_path='.:/opt/remi/php72/root/usr/share/pear:/opt/remi/php72/root/usr/share/php:
/usr/share/pear:/usr/share/php') in /chroot/home/a3c706ea/xyz/html/update/app/bootstrap.php on line 15

We were setting up out of the box Magento 2 the following three cron jobs -:

* * * * * php /home/example/example.com/html/bin/magento cron:run
* * * * * php /home/example/example.com/html/update/cron.php
* * * * * php /home/example/example.com/html/bin/magento setup:cron:run

The above mentioned error came when we are trying to run second cron job which is /update/cron.php manually.

To resolve the problem, we SSHed on the server and run the following command under /update/ directory-:

composer install

And voila, it resolved the problem! Hope this article helped you in some way. Please leave us your comment and let us know what do you think? Thanks.

Discover more from WHO WILL CARE eCommerce

Subscribe now to keep reading and get access to the full archive.

Continue reading