env.php reference

The env.php file contains the following sections:

Name Description
backend Settings for the Admin area
cache_types Cache storage settings
cron Enable or disable the cron jobs
crypt The encryption key for cryptographic functions
db Database connection settings
directories Magento directories mapping settings
downloadable_domains List of downloadable domains
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.

cron

Enable or disable cron jobs for the Magento application. By default, cron jobs are enabled. To disable them, add the cron configuration to the env.php file and set the value to 0.

1
2
3
'cron' => [
  'enabled' => 0
]

Be careful when you disable cron jobs. When they are disabled essential processes required by the Magento application will not run.

Learn more about Crons.

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'
    ]
  ]
]

directories

Optional directory mapping options that need to be set when the web server is configured to serve Magento app from the /pub directory for improved security.

1
2
3
'directories' => [
    'document_root_is_pub' => true
]

downloadable_domains

A list of downloadable domains available in this node. Additional domains can be added, removed, or listed using CLI commands.

1
2
3
'downloadable_domains' => [
    'local.vanilla.com'
]

Learn more about Downloadable Domains commands.

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.