Magento 2 developer VS production mode

Here are the main differences between Magento 2 developer and production mode.

Developer mode features:

  1. PHP stack trace for exceptions is displayed in browser.
  2. Every XML file that Magento parses is validated against its schema file. So errors can be seen immediately.
  3. 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.
  4. Debug HTTP headers are added to responses (X-Magento-Cache-Control, X-Magento-Cache-Debug).
  5. Developer configuration is visible under Stores -> Configuration -> Advanced -> Developer section in Admin area.
  6. Debug logging can be enabled under Stores -> Configuration -> Advanced -> Developer -> Debug section.
  7. 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 features:

  1. 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.  
  2. PHP stack trace is hidden in browser. Exceptions can be found in var/report directory instead.
  3. Errors in XML files are ignored. No exception is thrown like in developer mode just 404 error can be shown in browser.
  4. Debug logging is always disabled in production mode.
  5. Stores -> Configuration -> Advanced -> Developer section is hidden in Admin area in production mode. So minification or merging is not available in Admin.
  6. Caching cannot be disabled in production mode under System -> Cache Management grid in Admin area. But it can be disabled/enabled via console.

Source: https://www.mage2.tv/

Leave a Reply

Close Menu