Loading…

Magento 2 modes – How to enable developer/production mode

Magento 2 can run into the following modes:

– default

– developer

– production

 

Magento 2 comes with the default mode activated.

If you do a change in the view files, it cannot be seen until you clean the generated static view files.

 

The developer mode should be used when you do customizations or you develop an extension, because you need to be able to see the error messages.

In the developer mode the errors/exceptions are shown in the browser, being easy to observe and debug them.

The static view files are generated every time they are requested.

In the developer mode the cache is not used, meaning that the changes that you do are visible, that’s why this mode has a very big impact on the performance.

You should not use this mode on production!

 

The production mode should be activated only on production, as the name suggests.

Using this mode on production your website will have a higher performance, than the other modes.

The errors/exceptions are caught in the error logs and never displayed on the website.

The static view  files are not generated every time they are requested, and are served from cache.

 

You can check your Magento mode by running this command:

php bin/magento deploy:mode:show

 

If you want to enable the developer mode on Magento 2 (or to enable the production mode), you have 2 ways of doing this:

  • From terminal you can go to your Magento 2 directory and run:
    php bin/magento deploy:mode:set developer
  •  Or you can go to:

           app/etc/env.php

         Then go to ‘MAGE_MODE’ and set it to developer like this:

         ‘MAGE_MODE’ => ‘developer’

 

 

 

Leave a Reply