You are reading the documentation for version 2.2. Magento 2.3 is the latest version available. Ensure you are reading the documentation for your version of Magento.

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.php and app/etc/env.php.

  • app/etc/config.php is 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.php file is no longer an entry in the .gitignore file. This was done to facilitate pipeline deployment.

  • app/etc/env.php contains settings that are specific to the installation environment.

Together, config.php and 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. (config.php and env.php are merged with each other, however.)

Details about the deployment configuration

config.php and 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—config.php and env.php.

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).

Examples:

config.php snippet:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
return array (
  'modules' =>
  array (
    'Magento_Core' => 1,
    'Magento_Store' => 1,
    'Magento_Theme' => 1,
    'Magento_Authorization' => 1,
    'Magento_Directory' => 1,
    'Magento_Backend' => 1,
    'Magento_Backup' => 1,
    'Magento_Eav' => 1,
    'Magento_Customer' => 1,
...
  ),
);

The value 1 or 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.

Module configuration files