The difference between Development and Production mode

Magento has 2 modes:

DEVELOPER mode, which features:

  • PHP stack trace for exceptions is displayed in browser.
  • Every XML file that Magento parses is validated against its schema file. So errors can be seen immediately.
  • Static assets (images, CSS files, web fonts, JS files) are symlinked on demand to pub/static folder. So that they can be recreated on the fly and accessed by web browser from pub/static folder if these files were previously deleted.
  • Debug HTTP headers are added to response (X-Magento-Cache-Control, X-Magento-Cache-Debug).
  • Developer configuration is visible under Stores -> Configuration -> Advanced -> Developer section in Admin area.
  • Debug logging can be enabled under Stores -> Configuration -> Advanced -> Developer -> Debug section.
  • Static asset minification of JS and CSS files as well as JS bundling cannot be applied in developer mode. Only merging can be applied in developer mode.

PRODUCTION mode, which features:

  • Static assets are not symlinked or generated on the fly. Magento expects those files to already exist as regular files in pub/static folder after running bin/magento setup:static-content:deploy command. If a file is missing, Magento generates 404 error. But since Magento version 2.2.4 there is a configuration setting 'static_content_on_demand_in_production' => 1 that can be added to etc/env.php file that allows static assets to be generated on demand in production mode.
  • PHP stack trace is hidden in browser. Exceptions can be found in var/report directory instead.
  • Errors in XML files are ignored. No exception is thrown like in developer mode just 404 error can be shown in browser.
  • Debug logging is always disabled in production mode.
  • Stores -> Configuration -> Advanced -> Developer section is hidden in Admin area in production mode. So minification or merging is not available in Admin.
  • Caching cannot be disabled in production mode under System -> Cache Management grid in Admin area. But it can be disabled/enabled via console.


Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 7000