Magento 2.4.5-p1

I have a problem which I'm guessing stems from some illegal characters in some of my product fields which results in the products in categories NOT loading every once in a while. When I run reindex manually via SSH (Putty):

php bin/magento indexer:reindex

It brings the products back and shows them in categories on the front end as expected.

I haven't had a chance to manually go through all products and check/correct the irregularities. I have setup the following cron jobs in my cPanel initially to run every hour but there must be something wrong because the site still keeps crashing at least once a day and when I waited for the tasks to run, it still didn't fix it (even-though there was reindex in there). This makes me believe the commands are not actually getting executed. I have since changed the times from each hour every day to the following:

3,8,13,18,23,28,33,38,43,48,53,58   *   *   *   *   /opt/cpanel/ea-php74/root/usr/bin/php /home/MYSITE/public_html/cron.php > /dev/null    

*/10    *   *   *   *   /opt/cpanel/ea-php74/root/usr/bin/php /home/MYSITE/public_html/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> 

10  14  *   *   *   cd /home/MYSITE/public_html %% php bin/magento setup:di:compile
13  14  *   *   *   cd /home/MYSITE/public_html && php bin/magento setup:static-content:deploy -f
3   14  *   *   *   cd /home/MYSITE/public_html && php bin/magento cache:clean

5   14  *   *   *   cd /home/MYSITE/public_html && php bin/magento cache:flush

0,17,30,45  *   *   *   *   cd /home/MYSITE/public_html && php bin/magento indexer:reindex

7   14  *   *   *   cd /home/MYSITE/public_html && php bin/magento setup:static-content:deploy -f

Do these appear to have the correct syntax?

Is there any other way to execute reindex manually? I will be traveling for a week and I won't have access to SSH (Putty).

1 Answer 1


At first glance I wouldn't be surprised if only the first two are actually running correctly. If your cPanel instance is capable of running multiple PHP versions you should explicitly define the PHP version path used for each cronjob as is the case with the first two jobs. Otherwise you may find a version other than 7.4 in use for cli commands.

Regardless, my suggestion would be:

  1. Backup your schedule then start from scratch, nuke this cron setup entirely
  2. From the command line run php bin/magento cron:install
  3. Now edit your crontab schedule and emulate the structure magento uses for all of your additional jobs. Specifically the path it takes to PHP
  4. To run a job every 15 minutes the schedule would be: */15 * * * *
  5. If you want to have a better idea of whether each job is actually running then use the logs with the same approach as magento by adding the following to the tail end of each job 2>&1 | grep -v "ADD SOME CONTEXT" >> /home/MYSITE/public_html/var/log/magento.cron.log
  6. If you're looking for something to keep you out of the logs consider using cronhub.io for external monitoring of cronjobs
  7. If you still need a way to manually index you could use the following module: https://github.com/magepal/magento2-reindex

I'm sure you have your reasons, but without further context I'm confused as to why you are scheduling compile and deploy jobs so regularly. This shouldn't be something you need to do on a regular schedule.

Hope this helps you solve your scheduling issues. Good luck!

Your Answer

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

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