cancel
Showing results for 
Search instead for 
Did you mean: 

Magento commands doesn't work

SOLVED

Magento commands doesn't work

Hello

I am having a problem trying to migrate my magento2 board from server to my local host, i copy the database and files i changed app/etc/env.php config parameters to fit with the local host, i did the changes in the database about the secures urls.

But i can't to clear the cache using the commands

php bin/magento cache:clean

bin/magento cache:flush

i obtaining

[InvalidArgumentException]
There are no commands defined in the "cache" namespace.

I run

php bin/magento list

resulting in

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.

[Credis Exception]
Connection to Redis failed after 2 failures.Last Error : (111) Connection refused
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento commands doesn't work

@egomezgt99259a 

Good to hear problem solved, for blank page please check server logs what is the error you will get some hints by checking error logs.

 

Let me know if you need more help. ThankS!

 

Hope given answer helpful to you to solved problem. Click on 'Kudos' & Accept as Solution!

Manish Mittal
https://www.manishmittal.com/

View solution in original post

11 REPLIES 11

Re: Magento commands doesn't work

@egomezgt99259a 

 

Run 

rm -rf pub/static/*  var/view_preprocessed/ var/generation var/page_cache var/di

Now try to run

php bin/magento setup:di:compile
php bin/magento cache:flush
Manish Mittal
https://www.manishmittal.com/

Re: Magento commands doesn't work

I got the same error in console, my website is running online but for now i can't do a copy to my local host

Re: Magento commands doesn't work

@egomezgt99259a 

 

have you followed shared steps?

Manish Mittal
https://www.manishmittal.com/

Re: Magento commands doesn't work

yes i followed remove the cache using rm command the i tried to remove it using the magento command line, but i got the same error

Re: Magento commands doesn't work

@egomezgt99259a 

are you using redis? please check env.php if you are not sure. 

Manish Mittal
https://www.manishmittal.com/

Re: Magento commands doesn't work

yes i am using redis

env.php

<?php
return array (
  'backend' => 
  array (
    'frontName' => 'storeadmin',
  ),
  'crypt' => 
  array (
    'key' => '644704b67d979b5034f0fe1230559b18',
  ),
  'session' => 
  array (
    'save' => 'files',
    'save_path' => 'var/sessions/',
  ),
  'db' => 
  array (
    'table_prefix' => 'tc_',
    'connection' => 
    array (
      'default' => 
      array (
        'host' => 'localhost',
        'dbname' => 'grupototal_magento',
        'username' => 'grupototal_dbuser',
        'password' => 'hkEJP2XuEMN1jjspw==',
        'active' => '1',
      ),
    ),
  ),
  'resource' => 
  array (
    'default_setup' => 
    array (
      'connection' => 'default',
    ),
  ),
  'x-frame-options' => 'SAMEORIGIN',
  'MAGE_MODE' => 'production',
  'cache_types' => 
  array (
    'config' => 1,
    'layout' => 1,
    'block_html' => 1,
    'collections' => 1,
    'reflection' => 1,
    'db_ddl' => 1,
    'eav' => 1,
    'customer_notification' => 1,
    'full_page' => 1,
    'config_integration' => 1,
    'config_integration_api' => 1,
    'translate' => 1,
    'config_webservice' => 1,
    'compiled_config' => 1,
  ),
  'cache' => 
  array (
    'frontend' => 
    array (
      'default' => 
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' => 
        array (
          'server' => '127.0.0.1',
          'database' => '0',
          'port' => '6379',
          'persistent' => '',
          'force_standalone' => '0',
          'connect_retries' => '1',
          'read_timeout' => '10',
          'automatic_cleaning_factor' => '0',
          'compress_data' => '1',
          'compress_tags' => '1',
          'compress_threshold' => '20480',
          'compression_lib' => 'gzip',
        ),
      ),
      'page_cache' => 
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' => 
        array (
          'server' => '127.0.0.1',
          'port' => '6379',
          'database' => '1',
          'persistent' => '',
          'force_standalone' => '0',
          'connect_retries' => '1',
          'read_timeout' => '10',
          'automatic_cleaning_factor' => '0',
          'compress_data' => '0',
          'compress_tags' => '1',
          'compress_threshold' => '20480',
          'compression_lib' => 'gzip',
        ),
      ),
    ),
  ),
  'install' => 
  array (
    'date' => 'Thu, 10 Aug 2017 15:33:27 +0000',
  ),
);

Re: Magento commands doesn't work

@egomezgt99259a 

 

Just remove content of env.php don't share it publicly and your redis is showing localhost 127.0.0.1 do you have redis server on your live please connect with that. 

 

Try to connect on server with redis that it is working or not 

Manish Mittal
https://www.manishmittal.com/

Re: Magento commands doesn't work

Excuse me could you be more specific please, what part should i remove from the env.php file ?

Re: Magento commands doesn't work

where is your redis configured on live site? what is the host for that?

Manish Mittal
https://www.manishmittal.com/