1

I have installed Magento2 on my machine, I am using osx yosemite, and on admin panel I am getting

One or more indexers are invalid. Make sure your Magento cron job is running.

I have tried

php bin/magento indexer:reindex

to re index the indexes, and

php bin/magento cron:run

to run cron job, every time I am getting

Magento supports PHP 5.6, 7.0.2, and 7.0.6 or later. Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html

But I am using php 5.6.10 on MAMP

1

To solve this, I have chnaged osx'x php to MAMP's php, by following the Instructions to Change PHP Installation First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php

This should output the path to the default PHP install which comes preinstalled by Mac OS X, by default it has to be (Assuming you've not changed it before):

/usr/bin/php

Now, We just need to swap this over to the PHP that is installed with MAMP, which is located at /Applications/MAMP/bin/php/php5.4.10/bin (MAMP 2.1.3), or your php's version selected in MAMP

To do this, We need to edit the .bash_profile and add the MAMP version of PHP to the PATH variable. Follow these simple steps:

Within the Terminal, run vim ~/.bash_profile

Type i and then paste the following at the top of the file:

export PATH=/Applications/MAMP/bin/php/php5.4.10/bin:$PATH

Hit ESC, Type :wq, and hit Enter

In Terminal, run source ~/.bash_profile

In Terminal, type in which php again and look for the updated string. If everything was successful, It should output the new path to MAMP PHP install.

In case it doesn't output the correct path, try closing the terminal window (exit fully) and open again, it should apply the changes (Restart in short).

1

Maybe you can try doing this:

CD /Applications/MAMP/htdocs/magento/bin
:bin > ./magento indexer:reindex
:bin > ./magento cron:run

Reference: https://gist.github.com/aarthiathi/2f229fa1dac007d8b43f8fc921e81218

  • This worked for me but my installation path was different since I didn't do the install inside MAMPs folders. Just go inside your magento2 project folder, wherever that is and navigate to the /bin directory. Then run the two commands above ./magento indexer:reindex and ./magento cron:run – Nate Beers Apr 26 '18 at 6:33
0

Try this: In terminal, type crontab -e Then enter these 2 lines:

*/1 * * * * php -c /Applications/MAMP/bin/php/php5.6.10/conf/php.ini /path/to/your/m2installation/bin/magento cron:run
*/1 * * * * php -c /Applications/MAMP/bin/php/php5.6.10/conf/php.ini /path/to/your/m2installation/bin/magento setup:cron:run

Save and try again.

  • In terminal I typed crontab -e, and terminal is opened in vim mode, I placed given two lines after editing, but unable to save it by Esc :wq – Abdul Ghaffar Jul 13 '16 at 7:45
  • what message do you get when you use :wq? Try it from root folder of your project. – belfort1 Jul 13 '16 at 8:00
  • I am getting 'crontab: no crontab for AbdulGhaffar - using an empty one <br/> crontab: "/usr/bin/vi" exited with status 1' – Abdul Ghaffar Jul 13 '16 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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