Magento 2 modes: default, developer and production

There are 3 Magento 2 modes of operation that your system will be running on: developer, product and default mode. This setting is configured in your app/etc/env.php file, which is the value of ‘MAGE_MODE’ key.

Magento Mode value in app/etc/env.php

Your current Magento 2 modes can be seen in app/etc/env.php file

Now we should know what each of the three Magento 2 modes does to your system. The developer mode, which is the mode you will be using most of the time, will display all exceptions, undefined variables, …

Running on developer mode, your system will also turn on code generation, which is needed for the system’s object system. Front-end files such as js, css and template files generation will also be available.

Uncaught exceptions display in the browserIn Magento 2 developer mode, uncaught exceptions will display in the browser

Running your system on developer mode will make your developing extensions on Magento 2 easier for sure. But when the customers want to deploy Magento on their server, they will be using production mode, which will hide MOST of the errors, turn off code generation. When you switch from production to developer mode, you have to clear generated classes and object in var/generation to prevent errors.

Default mode is the combination of the two above, which will suppress error messages but will turn on code generation. We don’t normally use this mode.

To switch Magento 2 modes, either edit the file in app/etc/env.php or use the command:

You might want to clean the cache after that:

 

Share

Comments (1)

  1. Alex
    I have setup app/etc/env.php file, which is the value of ‘MAGE_MODE’ key. but i was stuck in Default Mode, your post really healed me to configure it and also for default mode i got helped from another post check here, https://www.cloudways.com/blog/magento-2-modes/, hope this is also useful for everyone.

Speak Your Mind

9 + 1 =