Enable or disable modules
Log in to the Magento server as, or switch to, a user who has permissions to write to the Magento file system. One way to do this is to switch to the Magento file system owner.
If you use the bash shell, you can also use the following syntax to switch to the Magento file system owner and enter the command at the same time:
su <Magento file system owner> -s /bin/bash -c <command>
If the Magento file system owner does not allow logins you can do the following:
sudo -u <Magento file system owner> <command>
To run Magento commands from any directory, add
<your Magento install dir>/binto your system
Because shells have differing syntax, consult a reference like unix.stackexchange.com.
bash shell example for CentOS:
You can also run the commands in the following ways:
cd <your Magento install dir>/binand run them as
./magento <command name>
php <your Magento install dir>/bin/magento <command name>
<your Magento install dir> is a subdirectory of your web server's docroot. Need help locating the docroot? Click here.
In addition to the command arguments discussed here, see Common arguments.
This command has no prerequisites.
Module enable, disable
To enable or disable available modules, use the following command:
magento module:enable [-c|--clear-static-content] [-f|--force] [--all] <module-list> magento module:disable [-c|--clear-static-content] [-f|--force] [--all] <module-list>
<module-list>is a space-delimited list of modules to enable or disable. If any module name contains special characters, enclose the name in either single or double quotes.
--allto enable or disable all modules at the same time.
--forceto force a module to be enabled or disabled despite dependencies. Before you use this option, see About enabling and disabling modules.
--clear-static-contentcleans generated static view files.
Failure to clear static view files might result in issues if there are multiple files with the same name and you don’t clear all of them.
In other words, because of static file fallback rules, if you do not clear static files and there is more than one file named
logo.gifthat are different, fallback might cause the wrong file to display.
Use the following command to list enabled and disabled modules:
For example, to disable the Weee module, enter:
magento module:disable Magento_Weee
For important information about enabling and disabling modules, see About enabling and disabling modules.
Update the database
If you enabled one or more modules, run the following command to update the database:
About enabling and disabling modules
Magento enables you to enable or disable currently available modules; in other words, any Magento-provided module or any third-party module that is currently available.
Certain modules have dependencies on other modules, in which case you might not be able to enable or disable a module because it has dependencies on other modules.
In addition, there might be conflicting modules that cannot both be enabled at the same time.
- Module A depends on Module B. You cannot disable Module B unless you first disable Module A.
- Module A depends on Module B, both of which are disabled. You must enable module B before you can enable module A.
- Module A conflicts with Module B. You can disable Module A and Module B, or you can disable either module but you cannot enable Module A and Module B at the same time.
Dependencies are declared in the
require field in Magento's
composer.json file for each module. Conflicts are declared in the
conflict field in modules'
composer.json files. We use that information to build a dependency graph:
A->Bmeans module A depends on module B.
- A dependency chain is the path from a module to another one. For example, if module A depends on module B and module B depends on module C, then the dependency chain is
If you attempt to enable or disable a module that depends on other modules, the dependency graph displays in the error message.
It's possible that module A's
composer.json declares a conflict with module B but not vice versa.
Command line module enable or disable subcommand only: To force a module to be enabled or disabled regardless of its dependencies, use the optional
--force can disable your Magento store and cause problems accessing the Magento Admin.