env.php reference

The env.php file contains the following sections:

Name Description
backend Settings for the Admin area
cache_types Cache storage settings
crypt The encryption key for cryptographic functions
db Database connection settings
install The installation date
lock Lock provider settings
MAGE_MODE The Magento mode
queue Message queues settings
resource Mapping of resource name to a connection
session Session storage data
x-frame-options Setting for x-frame-options

backend

Configure the frontName for the Magento admin url using the backend node in env.php.

1
2
3
'backend' => [
  'frontName' => 'admin'
]

cache_types

All the Magento cache types configuration are available from this node.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'cache_types' => [
  'config' => 1,
  'layout' => 1,
  'block_html' => 1,
  'collections' => 1,
  'reflection' => 1,
  'db_ddl' => 1,
  'compiled_config' => 1,
  'eav' => 1,
  'customer_notification' => 1,
  'config_integration' => 1,
  'config_integration_api' => 1,
  'full_page' => 1,
  'config_webservice' => 1,
  'translate' => 1,
  'vertex' => 1
]

Learn more about different Cache Types.

crypt

Magento uses an encryption key to protect passwords and other sensitive data. This key is generated during the Magento installation process.

1
2
3
'crypt' => [
  'key' => '63d409380ccb1182bfb27c231b732f05'
]

You can learn more about it at Encryption Key.

db

All database configurations are availble in this node.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'db' => [
  'table_prefix' => '',
  'connection' => [
    'default' => [
      'host' => 'localhost',
      'dbname' => 'magento_db',
      'username' => 'root',
      'password' => 'admin123',
      'model' => 'mysql4',
      'engine' => 'innodb',
      'initStatements' => 'SET NAMES utf8;',
      'active' => '1'
    ]
  ]
]

install

The installation date of Magento application.

1
2
3
'install' => [
  'date' => 'Tue, 23 Apr 2019 09:31:07 +0000'
]

lock

Lock provider settings are configured using the lock node.

Learn more about the lock provider at Lock Provider Configuration.

MAGE_MODE

The Magento deploy mode can be configured in this node.

1
'MAGE_MODE' => 'developer'

Learn more about Magento Modes.

queue

Message queue releated configurations are availble in this node.

1
2
3
4
5
6
'queue' => [
  'topics' => [
    'customer.created' => [publisher="default-rabitmq"],
    'order.created' => [publisher="default-rabitmq"],
  ]
]

Learn more about Message queue in below link Message Queue

resource

Resource configuration settings are avilable in this node.

1
2
3
4
5
'resource' => [
  'default_setup' => [
    'connection' => 'default'
  ]
]

session

Magento session related configurations are stoted in the session node.

1
2
3
'session' => [
  'save' => 'files'
],

Learn more about session in Session.

x-frame-options

x-frame-options header can be configured using this node.

1
'x-frame-options' => 'SAMEORIGIN'

Learn more about session in x-frame-options.