Magento 2 platform can be used in any of these 3 offered modes:
Magento 2 default mode
The mode shows how the platform operates without any custom settings. Running the mode you can set up the Magento app on a single server without any changes. Nevertheless, the default mode lacks essential characteristics used for production. Therefore, if you need to set up the platform on several servers or use it for production, you need to choose among the modes listed below.
Detailed consideration:
Magento 2 developer mode
The mode is used in case you need to customize Magento 2 or install extensions.
Detailed consideration:
Magento 2 production mode
The mode is used as the main regime for working with Magento. If you need Magento 2 to be set up on a production server, this mode should be applied.
Detailed consideration:
Use the php bin/magento deploy:mode:show command as the Magento file system owner:
You will get a message like this:
Current application mode: developer.
Use the php bin/magento deploy:mode:set {mode} [-s|--skip-compilation] command to switch to a mode you need.
*In this command {mode} stands for either developer or production mode;
* --skip-compilation is an optional specification used only during modes change for code compilation avoidance.
E.g.#1: change to Magento 2 developer mode
If you want to change or enable the production mode to developer, all the generated classes and Object Manager entities should be cleared for preventing possible errors, for instance, entities like proxies should be cleared before a Magento 2 mode change.
1.The var/generation, var/directories content should be deleted:
rm -rf <your Magento install dir>/var/di/* <your Magento install dir>/var/generation/*
2. Then set the Magento 2 developer mode:
php bin/magento deploy:mode:set developer
3. Receive the next message:
Switched to developer mode.
To disable developer mode in Magento 2, switch the mode to production.
E.g.#2: Enable Magento 2 production mode
If changing the {mode} parameter to production, you’ll get the next messages:
Enabled maintenance mode
Requested languages: en_US
=== frontend -> Magento/luma -> en_US ===
... more ...
Successful: 1884 files; errors: 0
---
=== frontend -> Magento/blank -> en_US ===
... more ...
Successful: 1828 files; errors: 0
---
=== adminhtml -> Magento/backend -> en_US ===
... more ...
---
=== Minify templates ===
... more ...
Successful: 897 files modified
---
New version of deployed files: 1440461332
Static content deployment complete Gathering css/styles-m.less sources. Successfully processed LESS and/or <span term-uuid="45f1f76d-91cd-4789-a8b5-1e3f321a6280" class="glossary-term" data-toggle="popover">SASS</span> files <span term-uuid="6c5cb4e9-9197-46f2-ba79-6147d9bfe66d" class="glossary-term" data-toggle="popover">CSS</span> deployment complete Generated classes:
Magento\Sales\Api\Data\CreditmemoCommentInterfacePersistor
Magento\Sales\Api\Data\CreditmemoCommentInterfaceFactory
Magento\Sales\Api\Data\CreditmemoCommentSearchResultInterfaceFactory
Magento\Sales\Api\Data\CreditmemoComment\Repository
Magento\Sales\Api\Data\CreditmemoItemInterfacePersistor
... more ...
Compilation complete
Disabled maintenance mode
Enabled production mode.
The developer and production modes are the most usable among Magento admins. All the modes are interchangeable. The only exception is the default mode, which can’t be applied after switching to the developer one.
According to the statistics, you may find helpfull the following question about less compilation modes.
There is no direct setting in the admin panel, but you can do it using certain commands.
You need to use the php bin/magento deploy:mode:set {mode} [-s|--skip-compilation] command to switch to a mode.
*In this command {mode} stands for either developer or production mode;
* --skip-compilation is an optional specification used only during modes change for code compilation avoidance.
If you want to change or enable the production mode to developer, all the generated classes and Object Manager entities should be cleared for preventing possible errors, for instance, entities like proxies should be cleared before a mode change.
Step 1. You should delete the var/generation and var/directories content:
rm -rf <your Magento install dir>/var/di/* <your Magento install dir>/var/generation/*
Step 2. The next step is to set the required mode:
php bin/magento deploy:mode:set developer
After these steps you will get a message:
Switched to developer mode.
Login and Registration Form