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:
<Magento base dir>/app/etc/config.php, referred to as the shared configuration file, because you can check it in to source control and use it in your development, staging, and production systems
config.phpcontains the list of installed modules, themes, and language packages; and shared configuration settings
<Magento base dir>/app/etc/env.php, which contains system-specific settings, such as:
- Database credentials and connection settings
- i18n TBD
- Cache storage settings
- Session storage settings
- x-frame-options setting
- Enabled cache types
- Your encryption key
- Web routing parameters (base URLs, Magento Admin URI)
- Magento mode
- Magento installation date
- System-specific and sensitive configuration settings TBD
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 components (modules, themes, and language packages). Magento provides both command-line and web-based utilities to manage components (install, uninstall, enable, disable, or upgrade).
- Uninstall components:
- Enable or disable components:
- Component Manager: coming soon
- System Upgrade: coming soon
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.
The following table provides details about each
env.php segment and its structure.
__/db |__/connection | |__/[default] | |-- host | |-- dbname | |-- username | |-- password | |-- model [mysql4] | |-- initStatements [SET NAMES utf8;] | |-- active  |-- table_prefix
__/resource |__/default_setup |-- connection [default]
__/session |__/save |-- <files|db>
|Admin URL path||
__/backend |-- frontName
__/cache |__/frontend |__/See frontend options
__/install |-- date
__/crypt |-- key
__/cache_types |-- <enumerated cache types>
__/queue |__/amqp |-- host |-- port |-- user |-- password |-- virtualhost |-- ssl