How to setup Magento 2.2 cron job?












5















I have just made a fresh installation of Magento 2.2.1 to eventually be able to migrate from my present 1.7.



But I already encountered some difficulties.
The message "One or more indexes are invalid. Make sure your Magento cron job is running." is showing in admin.



I tried to google how to get the cron job running but can't find how to do it in cPanel, and I don't understand how to get it running.
I do not have SSH access and can't do anything through CLI. Does anybody know how I can get this cron thing set up and working from cPanel?










share|improve this question

























  • whether your issue is solved

    – Visakh B Sujathan
    Feb 6 '18 at 10:16
















5















I have just made a fresh installation of Magento 2.2.1 to eventually be able to migrate from my present 1.7.



But I already encountered some difficulties.
The message "One or more indexes are invalid. Make sure your Magento cron job is running." is showing in admin.



I tried to google how to get the cron job running but can't find how to do it in cPanel, and I don't understand how to get it running.
I do not have SSH access and can't do anything through CLI. Does anybody know how I can get this cron thing set up and working from cPanel?










share|improve this question

























  • whether your issue is solved

    – Visakh B Sujathan
    Feb 6 '18 at 10:16














5












5








5


1






I have just made a fresh installation of Magento 2.2.1 to eventually be able to migrate from my present 1.7.



But I already encountered some difficulties.
The message "One or more indexes are invalid. Make sure your Magento cron job is running." is showing in admin.



I tried to google how to get the cron job running but can't find how to do it in cPanel, and I don't understand how to get it running.
I do not have SSH access and can't do anything through CLI. Does anybody know how I can get this cron thing set up and working from cPanel?










share|improve this question
















I have just made a fresh installation of Magento 2.2.1 to eventually be able to migrate from my present 1.7.



But I already encountered some difficulties.
The message "One or more indexes are invalid. Make sure your Magento cron job is running." is showing in admin.



I tried to google how to get the cron job running but can't find how to do it in cPanel, and I don't understand how to get it running.
I do not have SSH access and can't do anything through CLI. Does anybody know how I can get this cron thing set up and working from cPanel?







cron magento2.2 cpanel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '17 at 12:32









David Lambauer

6481416




6481416










asked Nov 22 '17 at 12:09









Ronnie79Ronnie79

2613




2613













  • whether your issue is solved

    – Visakh B Sujathan
    Feb 6 '18 at 10:16



















  • whether your issue is solved

    – Visakh B Sujathan
    Feb 6 '18 at 10:16

















whether your issue is solved

– Visakh B Sujathan
Feb 6 '18 at 10:16





whether your issue is solved

– Visakh B Sujathan
Feb 6 '18 at 10:16










4 Answers
4






active

oldest

votes


















3














you can add ssh via cpanel. try this link



after ssh is enabled.you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install.






share|improve this answer
























  • @Ronnie79 whether your issue is solved.if solved mark as resolved

    – Visakh B Sujathan
    Dec 1 '17 at 8:43



















1














You have to have SSH access to your Magento 2 installation in order to run it as smooth as it should. Make sure, you get the access.



As soon as you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install. That should be enough.



In case the only way for you is to add the cron through an admin interface like cpanel; try to add the cron jobs line by line.



* * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
* * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
* * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log


Depending in the admin panel, you might have to enter the path to the PHP binary. If you are not sure which path it is, just try php.






share|improve this answer


























  • Oh. Is there no way to do it in cPanel with Cron Job? Our Host doesn't allow SSH access to anyone for security reasons they say. But our host still offer Magento installation in their installatron...

    – Ronnie79
    Nov 22 '17 at 16:45













  • Are you able to add CronJobs through the cPanel?

    – David Lambauer
    Nov 22 '17 at 16:48











  • Can you enter something like * * * * www-data super_cool_command somewhere in cPanel?

    – David Lambauer
    Nov 22 '17 at 16:49











  • Yes, I can add a Cron Job in cPanel. One line command and choose if I want it to be run every minute, every hour etc. But don't know what command to write there to make it work...

    – Ronnie79
    Nov 22 '17 at 17:43













  • Nice! That is exactly what you need. I'll send you the lines in a few hours.

    – David Lambauer
    Nov 23 '17 at 6:26



















1














try this one
Here are the relevant lines in .htaccess (read the comments):



<FilesMatch "^cron.*.php$">
...
</FilesMatch>





share|improve this answer

































    0















    1. I think I sorted it out now.

    2. I was not sure if this is the right way but this is how I did it:


    I created one cron job that run every minute in my cPanel:



    /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:install


    Then after one minute when I got an email that this was performed I deleted it and created a new one like this instead:



    /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:run






    share|improve this answer


























    • Or do I also need to add * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log as cron jobs?

      – Ronnie79
      Dec 2 '17 at 9:36











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f202732%2fhow-to-setup-magento-2-2-cron-job%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    you can add ssh via cpanel. try this link



    after ssh is enabled.you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install.






    share|improve this answer
























    • @Ronnie79 whether your issue is solved.if solved mark as resolved

      – Visakh B Sujathan
      Dec 1 '17 at 8:43
















    3














    you can add ssh via cpanel. try this link



    after ssh is enabled.you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install.






    share|improve this answer
























    • @Ronnie79 whether your issue is solved.if solved mark as resolved

      – Visakh B Sujathan
      Dec 1 '17 at 8:43














    3












    3








    3







    you can add ssh via cpanel. try this link



    after ssh is enabled.you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install.






    share|improve this answer













    you can add ssh via cpanel. try this link



    after ssh is enabled.you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 23 '17 at 6:24









    Visakh B SujathanVisakh B Sujathan

    357216




    357216













    • @Ronnie79 whether your issue is solved.if solved mark as resolved

      – Visakh B Sujathan
      Dec 1 '17 at 8:43



















    • @Ronnie79 whether your issue is solved.if solved mark as resolved

      – Visakh B Sujathan
      Dec 1 '17 at 8:43

















    @Ronnie79 whether your issue is solved.if solved mark as resolved

    – Visakh B Sujathan
    Dec 1 '17 at 8:43





    @Ronnie79 whether your issue is solved.if solved mark as resolved

    – Visakh B Sujathan
    Dec 1 '17 at 8:43













    1














    You have to have SSH access to your Magento 2 installation in order to run it as smooth as it should. Make sure, you get the access.



    As soon as you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install. That should be enough.



    In case the only way for you is to add the cron through an admin interface like cpanel; try to add the cron jobs line by line.



    * * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
    * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
    * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log


    Depending in the admin panel, you might have to enter the path to the PHP binary. If you are not sure which path it is, just try php.






    share|improve this answer


























    • Oh. Is there no way to do it in cPanel with Cron Job? Our Host doesn't allow SSH access to anyone for security reasons they say. But our host still offer Magento installation in their installatron...

      – Ronnie79
      Nov 22 '17 at 16:45













    • Are you able to add CronJobs through the cPanel?

      – David Lambauer
      Nov 22 '17 at 16:48











    • Can you enter something like * * * * www-data super_cool_command somewhere in cPanel?

      – David Lambauer
      Nov 22 '17 at 16:49











    • Yes, I can add a Cron Job in cPanel. One line command and choose if I want it to be run every minute, every hour etc. But don't know what command to write there to make it work...

      – Ronnie79
      Nov 22 '17 at 17:43













    • Nice! That is exactly what you need. I'll send you the lines in a few hours.

      – David Lambauer
      Nov 23 '17 at 6:26
















    1














    You have to have SSH access to your Magento 2 installation in order to run it as smooth as it should. Make sure, you get the access.



    As soon as you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install. That should be enough.



    In case the only way for you is to add the cron through an admin interface like cpanel; try to add the cron jobs line by line.



    * * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
    * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
    * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log


    Depending in the admin panel, you might have to enter the path to the PHP binary. If you are not sure which path it is, just try php.






    share|improve this answer


























    • Oh. Is there no way to do it in cPanel with Cron Job? Our Host doesn't allow SSH access to anyone for security reasons they say. But our host still offer Magento installation in their installatron...

      – Ronnie79
      Nov 22 '17 at 16:45













    • Are you able to add CronJobs through the cPanel?

      – David Lambauer
      Nov 22 '17 at 16:48











    • Can you enter something like * * * * www-data super_cool_command somewhere in cPanel?

      – David Lambauer
      Nov 22 '17 at 16:49











    • Yes, I can add a Cron Job in cPanel. One line command and choose if I want it to be run every minute, every hour etc. But don't know what command to write there to make it work...

      – Ronnie79
      Nov 22 '17 at 17:43













    • Nice! That is exactly what you need. I'll send you the lines in a few hours.

      – David Lambauer
      Nov 23 '17 at 6:26














    1












    1








    1







    You have to have SSH access to your Magento 2 installation in order to run it as smooth as it should. Make sure, you get the access.



    As soon as you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install. That should be enough.



    In case the only way for you is to add the cron through an admin interface like cpanel; try to add the cron jobs line by line.



    * * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
    * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
    * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log


    Depending in the admin panel, you might have to enter the path to the PHP binary. If you are not sure which path it is, just try php.






    share|improve this answer















    You have to have SSH access to your Magento 2 installation in order to run it as smooth as it should. Make sure, you get the access.



    As soon as you have access to your instance, go to the Magento 2 root directory and run php bin/magento cron:install. That should be enough.



    In case the only way for you is to add the cron through an admin interface like cpanel; try to add the cron jobs line by line.



    * * * * * <path to php binary> <magento install dir>/bin/magento cron:run | grep -v "Ran jobs by schedule" >> <magento install dir>/var/log/magento.cron.log
    * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log
    * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log


    Depending in the admin panel, you might have to enter the path to the PHP binary. If you are not sure which path it is, just try php.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 23 '17 at 7:49

























    answered Nov 22 '17 at 12:34









    David LambauerDavid Lambauer

    6481416




    6481416













    • Oh. Is there no way to do it in cPanel with Cron Job? Our Host doesn't allow SSH access to anyone for security reasons they say. But our host still offer Magento installation in their installatron...

      – Ronnie79
      Nov 22 '17 at 16:45













    • Are you able to add CronJobs through the cPanel?

      – David Lambauer
      Nov 22 '17 at 16:48











    • Can you enter something like * * * * www-data super_cool_command somewhere in cPanel?

      – David Lambauer
      Nov 22 '17 at 16:49











    • Yes, I can add a Cron Job in cPanel. One line command and choose if I want it to be run every minute, every hour etc. But don't know what command to write there to make it work...

      – Ronnie79
      Nov 22 '17 at 17:43













    • Nice! That is exactly what you need. I'll send you the lines in a few hours.

      – David Lambauer
      Nov 23 '17 at 6:26



















    • Oh. Is there no way to do it in cPanel with Cron Job? Our Host doesn't allow SSH access to anyone for security reasons they say. But our host still offer Magento installation in their installatron...

      – Ronnie79
      Nov 22 '17 at 16:45













    • Are you able to add CronJobs through the cPanel?

      – David Lambauer
      Nov 22 '17 at 16:48











    • Can you enter something like * * * * www-data super_cool_command somewhere in cPanel?

      – David Lambauer
      Nov 22 '17 at 16:49











    • Yes, I can add a Cron Job in cPanel. One line command and choose if I want it to be run every minute, every hour etc. But don't know what command to write there to make it work...

      – Ronnie79
      Nov 22 '17 at 17:43













    • Nice! That is exactly what you need. I'll send you the lines in a few hours.

      – David Lambauer
      Nov 23 '17 at 6:26

















    Oh. Is there no way to do it in cPanel with Cron Job? Our Host doesn't allow SSH access to anyone for security reasons they say. But our host still offer Magento installation in their installatron...

    – Ronnie79
    Nov 22 '17 at 16:45







    Oh. Is there no way to do it in cPanel with Cron Job? Our Host doesn't allow SSH access to anyone for security reasons they say. But our host still offer Magento installation in their installatron...

    – Ronnie79
    Nov 22 '17 at 16:45















    Are you able to add CronJobs through the cPanel?

    – David Lambauer
    Nov 22 '17 at 16:48





    Are you able to add CronJobs through the cPanel?

    – David Lambauer
    Nov 22 '17 at 16:48













    Can you enter something like * * * * www-data super_cool_command somewhere in cPanel?

    – David Lambauer
    Nov 22 '17 at 16:49





    Can you enter something like * * * * www-data super_cool_command somewhere in cPanel?

    – David Lambauer
    Nov 22 '17 at 16:49













    Yes, I can add a Cron Job in cPanel. One line command and choose if I want it to be run every minute, every hour etc. But don't know what command to write there to make it work...

    – Ronnie79
    Nov 22 '17 at 17:43







    Yes, I can add a Cron Job in cPanel. One line command and choose if I want it to be run every minute, every hour etc. But don't know what command to write there to make it work...

    – Ronnie79
    Nov 22 '17 at 17:43















    Nice! That is exactly what you need. I'll send you the lines in a few hours.

    – David Lambauer
    Nov 23 '17 at 6:26





    Nice! That is exactly what you need. I'll send you the lines in a few hours.

    – David Lambauer
    Nov 23 '17 at 6:26











    1














    try this one
    Here are the relevant lines in .htaccess (read the comments):



    <FilesMatch "^cron.*.php$">
    ...
    </FilesMatch>





    share|improve this answer






























      1














      try this one
      Here are the relevant lines in .htaccess (read the comments):



      <FilesMatch "^cron.*.php$">
      ...
      </FilesMatch>





      share|improve this answer




























        1












        1








        1







        try this one
        Here are the relevant lines in .htaccess (read the comments):



        <FilesMatch "^cron.*.php$">
        ...
        </FilesMatch>





        share|improve this answer















        try this one
        Here are the relevant lines in .htaccess (read the comments):



        <FilesMatch "^cron.*.php$">
        ...
        </FilesMatch>






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 23 '18 at 7:00

























        answered Nov 24 '17 at 9:17









        Visa EcitVisa Ecit

        114




        114























            0















            1. I think I sorted it out now.

            2. I was not sure if this is the right way but this is how I did it:


            I created one cron job that run every minute in my cPanel:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:install


            Then after one minute when I got an email that this was performed I deleted it and created a new one like this instead:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:run






            share|improve this answer


























            • Or do I also need to add * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log as cron jobs?

              – Ronnie79
              Dec 2 '17 at 9:36
















            0















            1. I think I sorted it out now.

            2. I was not sure if this is the right way but this is how I did it:


            I created one cron job that run every minute in my cPanel:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:install


            Then after one minute when I got an email that this was performed I deleted it and created a new one like this instead:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:run






            share|improve this answer


























            • Or do I also need to add * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log as cron jobs?

              – Ronnie79
              Dec 2 '17 at 9:36














            0












            0








            0








            1. I think I sorted it out now.

            2. I was not sure if this is the right way but this is how I did it:


            I created one cron job that run every minute in my cPanel:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:install


            Then after one minute when I got an email that this was performed I deleted it and created a new one like this instead:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:run






            share|improve this answer
















            1. I think I sorted it out now.

            2. I was not sure if this is the right way but this is how I did it:


            I created one cron job that run every minute in my cPanel:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:install


            Then after one minute when I got an email that this was performed I deleted it and created a new one like this instead:



            /usr/local/bin/php /home/[my username]/domains/[my domain]/public_html/bin/magento cron:run







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 11 mins ago









            Teja Bhagavan Kollepara

            2,98141947




            2,98141947










            answered Nov 24 '17 at 17:13









            Ronnie79Ronnie79

            2613




            2613













            • Or do I also need to add * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log as cron jobs?

              – Ronnie79
              Dec 2 '17 at 9:36



















            • Or do I also need to add * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log as cron jobs?

              – Ronnie79
              Dec 2 '17 at 9:36

















            Or do I also need to add * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log as cron jobs?

            – Ronnie79
            Dec 2 '17 at 9:36





            Or do I also need to add * * * * * <path to php binary> <magento install dir>/update/cron.php >> <magento install dir>/var/log/update.cron.log * * * * * <path to php binary> <magento install dir>/bin/magento setup:cron:run >> <magento install dir>/var/log/setup.cron.log as cron jobs?

            – Ronnie79
            Dec 2 '17 at 9:36


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f202732%2fhow-to-setup-magento-2-2-cron-job%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            What other Star Trek series did the main TNG cast show up in?

            Berlina muro

            Berlina aerponto