1

Was getting lots of issues installing, so installed Magento2 via Softaculous Installer in CPanel. Installed successfully and site & admin is accessible.

NOW, however, wanting to do things via CLI access, but always get "magento: command not found" when trying to run any of the commands.

Few questions having trouble finding answers for:

  1. In order to have access to CLI 'magento' commands, did I have to do the initial installation via composer or CLI to start?
  2. Is there any way to take the fresh working installation instance I have and enable the CLI magento commands without uninstalling and starting over? (Because was having a difficult time getting a stable, successful installation completed through doing CLI or Composer installation) - Although when I did have success a couple of times in the past (before I did something dumb to wack it up beyond my patience for troubleshooting, then deciding to start fresh again...) I DID get access to the Magento commands in CLI, and think they will ultimately prove to be an imperative asset in the future development of this project. :-/

Thanks in advance for any feedback here. Have worked on a couple of projects in Magento 1.*+ in the past, but really want to start this new project off in the new platform.

1
  • Quick questions - is the bin directory in your path? Is the execute bit on bun/magento? What OS? Can you give example command you are running? Yes, the CLI works - no additional setup... Depending on environment (eg is php in path, is it picking up right php.ini etc). I don't know what CPanel is
    – Alan Kent
    Commented Feb 6, 2016 at 18:29

5 Answers 5

4

I do not know if you did actually try to execute it with the php library.

For example my mistake on local OSX:

bin zarun$ magento -bash: magento: command not found

But it is actually supposed to be:

bin zarun$ php magento

Of course take a look at the available commands using the list option:

bin zarun$ php magento list

1
  • I saw a PHP tag in that file and thought that I would have to run it from localhost. = ) Commented Apr 29, 2018 at 18:26
1

Prefix your magento syntax with 'php'

 php magento xxxxxx

If it has any permission issue then try prefix with 'sudo php'

 sudo php magento xxxxxx
1
  • And not to mentioned, it needs to run at var/www/html/magento/bin Commented Jul 24, 2017 at 23:13
0

the commands should be available even if you did not install it via composer.

the error message you are having mostly is a misleading message covering another error.

you might want to clear the generation and cache folders under var/. (You can safely delete anything here except the .htaccess file).

https://github.com/magento/magento2/tree/develop/var

To make sure the classes are regenerated you either must be in developer or default mode (first few lines in your root directories .htaccess file. If it is commented out you should be in default mode) or you have to execute a command to generate all files (which you cant ;) )

https://github.com/magento/magento2/blob/develop/.htaccess#L5

after this you could try again. maybe just calling bin/magento list, which is a standard command of the symfony console component. It should then give you a list of all magento commands

0

You might delete the content in var/generation folder.

0

this did worked for me by adding php bin

php bin/magento list

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.