Change Magento 2 mode (developer vs production) Print

  • magento, magento 2, magento mode, developer, production, default, bin/magento, cpanel, public_html
  • 0

Unlike Magento 1 whose developer mode was basic and complex to configure, Magento 2 includes three easy to change operating modes; default, developer and production.

Default is the mode that is configured by a standard Magento install. It is almost the same as production, with some minor caches deactivated, and only serious errors logged to the browser.
Developer runs with minimal caching and rewriting, and displays all error logs to the browser, hence it is ideal for code editing and testing.
Production enables all caches, never displays any errors in the browser, and enforces a symlinked static/media setup.

How to check the current mode

  1. Enter your public_html directory (or wherever Magento is installed)
  2. Type (or copy/paste) bin/magento deploy:mode:show

Change to developer mode

  1. Enter your public_html directory (or wherever Magento is installed)
  2. Type bin/magento deploy:mode:set developer
  3. Delete the contents of generated code and metadata directories:
    rm -rf generated/metadata/*
    rm -rf generated/code/*

Change to default mode (recommended)

  1. Enter your public_html directory (or wherever Magento is installed)
  2. Type bin/magento deploy:mode:set default

Change to production mode

  1. Enter your public_html directory (or wherever Magento is installed)
  2. Type bin/magento deploy:mode:set production
  3. Sanity-check that your media and static symlinks are in place and working

 


Was this answer helpful?

« Back