richdynamix / magestead

The Vagrant Solution for Magento Developers
81 stars 29 forks source link

Using 'php magento' command #62

Closed joeainsworth closed 8 years ago

joeainsworth commented 8 years ago

In the CLI when I change directory into public/bin and then run php magento I get the following errors:

Available commands: help Displays help for a command list Lists commands

We're sorry, an error occurred. Try clearing the cache and code generation directories. By default, they are: var/cache, var/di, var/generation, and var/page_cache.

[CredisException]
Connection to Redis failed after 2 failures.Last Error : (61) Connection re
fused

I'm a Magento newbie and I've tried extensive Google searches but to no avail. This led me to assume it could be something to do with the magestead setup. Any ideas?

I just wanted to install magentos sample data via the CLI.

richdynamix commented 8 years ago

Hi @joeainsworth

The Magento cli tool requires access to your root installation folder to run any of your commands. As a result it expects the calling directory to be the root directory.

instead of cd public/bin; && php magento try the following -

$ cd public
$ php bin/magento

By calling the magento tool from within the root directory you are giving the tool access to your var folder for di, cache and generation folders.

Let me know how you get on before I close the ticket :)

joeainsworth commented 8 years ago

Great, thank you @richdynamix. This solved the issue.

joeainsworth commented 8 years ago

Hi @richdynamix

I created a new project with magestead and got the original error despite using cd public; php bin/magento.

I used vagrant ssh then cd /var/www and php bin/magento and this worked fine.

Any ideas?

Thanks Joe

richdynamix commented 8 years ago

Apologies. I was thinking of a previous version where I had the public folder the root folder. In the latest version the Magento 2 app is installed in /var/www. This is why it works there.