What are the modes in Magento 2?

Magento 2 can work in 3 modes: default, developer and production.

After installation, Magento 2 is in a default mode. It is aimed at users who are unaware of the possibility of changing the Magento 2 mode. Besides, it is between the developer and production state.

Default mode is not used for the development and production environment. When in default mode, Magento 2:

    • caches static files:
    • does not display errors in the clipboard (on the screen), but in the log file (magento2_folder / var / log).

Developer mode is ideal for developers. When in developer mode Magento 2:

  • does not cache static files;
  • displays a detailed error log on the screen;
  • automatically compiles the code;
  • allows advanced code debugging.
  • works slowly.

Production mode is used in the production environment. When in production mode, Magento 2:

  • caches all view-files;
  • doesn't change image size, when generating pages;
  • stores all errors in the log file;
  • allows integrating JavaScript into a bundle:
  • works fast.

How to show mode in Magento 2?

Run this CLI command:

php bin/magento deploy:mode:show

And get the following message:

Current application mode: developer

How to change modes in Magento 2?

Run the following CLI command:

php bin/magento deploy:mode:set {mode}

The {mode} parameter is required. You can use these values for it: developer, production or default. In older versions of Magento 2, you cannot return to the default mode after changing the mode.

Helpful Tip: You can change the MAGE_MODE value to default in the app/etc/env.php file to return Magento 2 to the default mode if tyou cannot do this with the CLI command.

Check the modes on your Magento 2 instances and change them if necessary.