cancel
Showing results for 
Search instead for 
Did you mean: 

CLI not recognizing magento commands

SOLVED

CLI not recognizing magento commands

I have successfully installed magento 2 via the ZIP file and can access the store front end and admin area. I also have SSH access to my shared server, but when I cd into my magento install dir and run ''magento" commands e.g. setting developer mode, I get an error saying the magento command is not found. Thanks in advance for any help!

1 ACCEPTED SOLUTION

Accepted Solutions

Re: CLI not recognizing magento commands

The root cause of my issue was incorrect php version (5.3.29), after talking to my host they recommended calling the PHP5.6 binary followed by the magento command and that worked. It took me nearly a week to work this out so I'm going to post exactly what I did to help others troubleshoot:

 

1. ssh into your server
2. cd into <magento install dir>/bin

3.  /usr/local/php56/bin/php-cli ./magento deploy:mode:show

 

 

View solution in original post

5 REPLIES 5

Re: CLI not recognizing magento commands

Hello HKGRPK,

Here are the steps to use magento cli command.

1. Navigate to the magento installed root directory
2. To clear cache: sudo php bin/magento cache:clean
3. To Compile: sudo php bin/magento setup:di:compile
4. To upgrade: sudo php bin/magento setup:upgrade
5. To enable mode sudo php bin/magento your command

another option navigates to bin directory and use as
php magento cache:clean

Re: CLI not recognizing magento commands

Hi Manish,

 

Thanks for the response, unfortunately after running #1 I get the following response:


-bash: sudo: command not found

 

I'm also thinking I need to upgrade the php version for CLI, when I run php -v it is telling me I'm on 5.3.29 - how do I upgrade the php version for CLI, I already went into c-panel and upgraded to php 7, but my understanding is that is not for CLI

 

Thanks in advance

Re: CLI not recognizing magento commands

The root cause of my issue was incorrect php version (5.3.29), after talking to my host they recommended calling the PHP5.6 binary followed by the magento command and that worked. It took me nearly a week to work this out so I'm going to post exactly what I did to help others troubleshoot:

 

1. ssh into your server
2. cd into <magento install dir>/bin

3.  /usr/local/php56/bin/php-cli ./magento deploy:mode:show

 

 

Re: CLI not recognizing magento commands

Glad to hear that you got the solution.

Re: CLI not recognizing magento commands

1. Navigate to the magento installed root directory
2. To clear cache: php bin/magento cache:clean
3. To Compile: php bin/magento setup:di:compile
4. To upgrade: php bin/magento setup:upgrade
5. To enable mode php bin/magento your command

another option navigates to bin directory and use as
php magento cache:clean

 

I highly recommend to NOT sudo these commands. Or you might end up with files which owner is root, which you are only able to edit/read if you are root. And hopefully this is neither for your user account nor for apache and php the case.