There are three main types of Magento 2 mode that your store can run under:
production. The default mode is the mode set when you first download the Magento application. Magento does not recommend using this mode when either carrying out development work, or when running the application in a live environment.
You can change the mode to
developer for example by running the following command provided by the
magento file located in the
Therefore if you
cd into your Magento project’s root directory, you can run the following:
$ /path/to/your/php bin/magento deploy:mode:set developer
If you’re unsure what mode is currently set, you can run the following command to show you:
$ /path/to/your/php bin/magento deploy:mode:show
What are the differences between the three modes?
You should use the
developer mode when you are making customisations to the application. This is because using this mode will display error messages that will be visible on the browser rather than being logged to the log files.
In this mode, static view files are generated every time they are requested. They are written to the
pub/static directory, but this has a negative impact on performance. However, this means that any changes made to the view files become immediately visible.
This mode should be used when deploying the website in a production environment. This mode is optimised for the highest performance.
In this mode, static view files are not created on the fly when they are requested; instead, they have to be deployed to the
pub/static directory using the command-line tool when changes are made to the view files with the following command.
$ /path/to/your/php bin/magento setup:static-content:deploy
The most important aspect of this mode is that errors are logged to the file system and are never displayed to the user. This is important for security reasons.
As the name implies, the default mode is used when no other mode has been specified within the application.
In this mode, errors are logged to files in the
var/reports directory and are never shown to a user. Static view files are generated on the fly and then cached. This is different to using developer mode, as view file changes are not visible until the generated static view files are cleared.
Because the static files are created on the fly and then cached, it is not recommended to run a Magento store in a product environment in this mode because of the performance impact this has.
This mode is used when no other mode is specified, and so the mode should be changed to either
production after downloading the application, depending on what environment you run it on.
Note: This article is based on Magento CE version 2.1.