This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

A Detailed Discussion on Magento 2 Modes

October 22, 2021

3 Min Read

One of the significant differences between Magento 1 and Magento 2 is the introduction of Magento Modes. These modes have different configurations of the Magento platform which affect the store’s performance and operations.

Magento 2 Modes

In Magento 1, there was a single state for both production and development, but in Magento 2, there are three primary Magento 2 modes:

  • Default Mode
  • Developer Mode
  • Production Mode

There is also another mode known as “Maintenance Mode,” but it operates very differently by preventing access to the system.

Default Mode

As the name describes, the Default mode is how Magento 2 works, if no other mode is specified. It lets you deploy Magento on a single server without changing any settings and configurations. However, the Default mode is not optimized for production.

The Default mode has the following key features:

  • Errors and Exceptions are never shown to the user. They are logged to var/reports directory at the server.
  • Symlinks to the static view files are published to the pub/static.
  • The Default mode hides custom X-Magento-* HTTP request and response headers
  • This mode is not optimized for the production environment because the static view files are first materialized and then cached.

Developer Mode

This mode is recommended for developers and is the recommended mode for the development. You should set the Magento 2 Developer mode when you need to customize and extend the platform’s functionalities. This mode is slower on the front end and the website admin.

Some other features of the Developer mode include:

  • Uncaught exceptions and errors displayed in the web browser.
  • Enhanced debugging.
  • Verbose system logging.
  • The exception is thrown in the web browser when an event subscriber cannot be invoked.
  • The exception appears in the error handler rather than being logged.
  • Automatic code compilation.

Production Mode

When your store is ready to go and has been deployed to a production server, you should set the Magento 2 in production mode. After that, you should also deploy the static view files to the Magento 2 pub/static directory because this improves the performance of the store.

In production mode

  • Static view files are not materialized. They are only served from the cache.
  • Errors are never displayed to the user. Instead, they are logged to the filesystem.

Setting Magento Modes

To change or set the Magento mode, you can use the following CLI command in your SSH Terminal:

php bin/magento deploy:mode:set {mode} [-s|--skip-compilation]

In the above command, {mode} is the required field. It can be either production or developer. –skip-compilation is the optional parameter used to skip code compilation when you set the Magento 2 to production mode.

After changing the mode, you might want to clean the cache as well by running the following command:

php bin/magento cache:clean

See the Current Mode

The easiest way of checking what mode is active right now, run the following CLI command:

php bin/magento deploy:mode:show

A message, similar to the following line will be displayed:

Current application mode: production

Final Thoughts

I hope now you will have a better understanding of the Magento 2 modes, as well as how to change the mode and see which mode your Magento 2 store is using.

Using the different modes for Magento 2 offers new ways for development and enhance the performance and functionality of the platform.

Cloudways always look for the new and improved ways of Magento server that help Magento merchants and community to grow and fulfill the complete Magento 2 hosting requirements. So please let us know if you have any questions or feedback!

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Great speed, features, knowledgebase, dashboard, UX and fast, expert support. Very happy!”

Stefan [Management Consultant]

Fayyaz Khattak

Fayyaz, a passionate Motorbike tourist, works as a Team Lead — Magento Community at Cloudways - A Managed Magento Hosting Platform. His objective is to learn & share about PHP & Magento Development in Community. You can contact him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

x

For 4 Months

Promo: BFCM2021
  • 28

days

  • 28

Hours

  • 28

Mins

  • 28

Secs