LinuxCommandLibrary

magento

Manage and configure Magento applications

TLDR

Enable one or more modules

$ magento module:enable [module1 module2 ...]
copy

Disable one or more modules
$ magento module:disable [module1 module2 ...]
copy

Update the database after enabling modules
$ magento setup:upgrade
copy

Update code and dependency injection configuration
$ magento setup:di:compile
copy

Deploy static assets
$ magento setup:static-content:deploy
copy

Enable maintenance mode
$ magento maintenance:enable
copy

Disable maintenance mode
$ magento maintenance:disable
copy

List all available commands
$ magento list
copy

SYNOPSIS

magento command [options]

PARAMETERS

setup:install
    Installs Magento 2.

setup:upgrade
    Upgrades Magento 2 installation.

cache:clean
    Cleans Magento 2 cache.

cache:flush
    Flushes Magento 2 cache storage.

index:reindex
    Reindexes Magento 2 indexes.

module:enable
    Enables a Magento 2 module.

module:disable
    Disables a Magento 2 module.

config:set
    Sets a Magento 2 configuration value.

--help
    Displays help for the command.

--version
    Displays Magento version.

DESCRIPTION

The magento command is the primary command-line interface (CLI) tool for managing and interacting with Magento 2 installations.
It provides a suite of commands for tasks such as installation, configuration, cache management, indexing, code generation, and module management. It is essential for both developers and system administrators for performing various operations on a Magento 2 store.

Using the magento command reduces the need for manual database manipulation or directly editing configuration files. This allows for a more structured and controlled approach to managing a Magento 2 store. It ensures proper configuration settings, updates, and upgrades are applied correctly and efficiently.

It facilitates automation through scripting and integration with deployment pipelines. This command is a powerful and integral tool for managing Magento 2.

CAVEATS

Requires appropriate file system permissions and user context for execution. Ensure Magento 2 installation directory is set up correctly.

FILE PERMISSIONS

Incorrect file permissions can prevent the magento command from functioning properly. Ensure the web server user has necessary read/write access to the Magento 2 installation directory.

PHP VERSION

The magento command requires a supported version of PHP. Verify that the PHP version installed on your system meets Magento's requirements.

MEMORY LIMITS

Some magento commands, such as setup:upgrade or index:reindex, may require a significant amount of memory. Adjust your PHP memory_limit setting in php.ini if needed.

HISTORY

The magento command was introduced with Magento 2 as the primary CLI tool, replacing the older method of accessing Magento functionalities through direct PHP execution. It provides a more structured and manageable way to interact with the system. Its development and features have evolved with subsequent Magento 2 releases, adding new commands and capabilities to improve efficiency and control.

Copied to clipboard