Deployment modes – Magento 2

There are three deployment mode is available in Magento 2.

  1. Default

  2. Developer

  3. Production

How to check which mode is enabled?

We check the currently enabled mode by running the below Magento command.

php bin/magento deploy:mode:show

Default Mode

It is a Magento default mode, once we switched from default mode to other modes, we can’t come back to default mode again by command line.

Developer Mode

  1. Better choice for development work

  2. Exception is visible in the browser

  3. XML files are validated against their schema and display errors in the browser

  4. Symlinks are enabled from the original source to pub/static. So if the static files are not found in the location, Magento will automatically generated from the original(extension/theme) source on the fly

  5. X-Magento-Cache-* Headers are only available in developer mode

  6. Admin -> Store -> configuration -> Advanced -> Developer This option is only available in developer mode

  7. JS, CSS minification and JS bundling is not work in development mode

  8. php bin/mageto setup:static-content:deploy is not work(necessary), we can add -f to forcefully generate static content in developer mode

  9. We can enable debug log

  10. If we change require-config.js, it will automatically merge into the pub/static/…require-config.js

Production Mode

  1. No symlinks are created from source to static assets (pub/static). If Magento is not found static assets, it won’t generate on the fly. We need to run static content deployment again to generate missing files. We can enable the symlink (on demand generation) of static content in production mode by adding below line app/etc/env.php

‘static_content_on_demand_in_production’ => 1,
  1. Errors are not displaying in the browser. It will display the error report file number, we need to check that in the location of var/report for the detailed report.

  2. XML validation errors are ignored and it won’t be displayed in the browser.

  3. Debug log is in disabled mode even if it is enabled in developer mode. Always, debug log is disabled in the production mode.

  4. Admin -> Store -> configuration -> Advanced -> Developer This option is not available in the production mode.

  5. We can’t disable cache from admin. We need to use magento command for enable/disable cache in production mode.

  6. X-Magento-Cache* is not available

  7. If we change require-config.js, it will not automatically merge into the pub/static/…require-config.js, we need generate static content to reflect the changes.

#developer #magento2 #modes #production

19 views0 comments

Recent Posts

See All

Magento 2 CMS block with the same ID already exists

I have seen the below error when I open cms block grid something went wrong with processing the default view and we have restored the filter to its original state. I found the below log in the excepti

How to generate bearer token - Magento 2 REST API

We can generate the admin bearer token using the below command. Please run the below command in the terminal to generate a token. curl -XPOST -H 'Content-Type: application/json'

Magento 2 script tag and available options in layout xml

We can add a script via layout XML file in Magento 2. The below format will stop the HTML parse until js downloaded and executed. <script src="Bilal_Usean/js/sample.min.js" /> The below format will st