Magento's deployment configuration
Purpose of the deployment configuration
Magento’s deployment configuration consists of the shared and system-specific configuration for your installation. Magento’s deployment configuration is divided between
app/etc/config.phpis the shared configuration file. This file contains the list of installed modules, themes, and language packages; and shared configuration settings.
Check this file in to source control and use it in your development, staging, and production systems.
As of the 2.2 release, the
app/etc/config.phpfile is no longer an entry in the
.gitignorefile. This was done to facilitate pipeline deployment.
app/etc/env.phpcontains settings that are specific to the installation environment.
env.php are referred to as Magento’s deployment configuration because they are created during installation and are required to start Magento.
The Magento 2 deployment configuration replaces
local.xml in Magento 1.x.
Unlike other module configuration files, Magento’s deployment configuration is loaded into memory when Magento initializes, is not merged with any other files, and cannot be extended. (
env.php are merged with each other, however.)
Details about the deployment configuration
env.php are PHP
files that return a multi-dimensional associative array, which is basically a hierarchical arrangement of configuration parameters and values.
On the top level of this array are configuration segments. A segment has arbitrary content (a scalar value or a nested array) distinguished by an arbitrary key—where both the key and its value are defined by the Magento framework.
Magento\Framework\App\DeploymentConfig merely provides access to these sections but does not allow you to extend them.
On the next hierarchy level, items in each segment are ordered according to the module sequence definition, which is obtained by merging all modules’ configuration files, with the exception of disabled modules.
The following sections discusses the structure and contents of the deployment configuration—
Manage installed modules
config.php lists your installed modules. Magento provides both command-line and web-based utilities to manage modules (install, uninstall, enable, disable, or upgrade).
- Uninstall components: bin/magento setup:uninstall
- Enable or disable components: bin/magento module:enable, bin/magento module:disable.
- Component Manager
- System Upgrade
0 indicates whether a module is enabled or disabled.
Disabled modules are not recognized by the Magento application; in other words, they don’t participate in merging configuration, in dependency injection, events, plug-ins, and so on. Disabled modules do not modify the storefront or Admin and don’t affect routing.
The only practical difference of a module being disabled and being completely absent in the code base is that a disabled module is found by the autoloader, enabling its classes and constants to be reused in other code.