← lessons

Explore application modes in Magento

Video Lesson: Explore application modes in Magento

Understand the four different application modes available in Magento: default, developer, production, and maintenance mode.

Mark Shust

TEACHER

Mark Shust

Published 1 month ago

Share with colleagues:

Share on X Share on LinkedIn

Lesson Content

Magento includes four different application modes, each designed for specific purposes. Let's explore how these modes work and when to use them.

Default mode

Default mode is what you get out of the box with Magento. While it lets you deploy the application to a single server with no config changes, it has some significant drawbacks:

  • Exceptions are written to log files instead of displayed in the browser

  • Static view files are cached, but not optimized for production

  • Custom Magento HTTP headers are hidden

This mode isn't recommended for either development or production environments. It’s a bit of a Frankenstein mode, and is just meant to get a storefront up and running really quickly, but you’ll want to move away from it just as fast.

Developer mode

Developer mode is your best friend during development. It's specifically designed for extending and customizing Magento, and comes with some features that make debugging easier, such as:

  • Automatic code compilation that happens on the fly

  • Uncaught exceptions display directly in the browser

  • More verbose system logging

  • Static view files aren't cached, but are generated on demand

  • Custom X-Magento-* HTTP headers are visible

  • Exceptions are thrown directly to the browser, rather than just logged

Production mode

This is the only mode you should use for live, customer-facing storefronts. It optimizes performance by:

  • Serving static view files exclusively from the cache

  • Logging errors, instead of displaying them

  • Restricting access to certain Admin configuration sections

A key difference from developer mode is that you need to deploy static view files manually when publishing code, which is typically done within a deployment script. This ensures all necessary files are immediately available at deployment, rather than being created on demand.

Some administrative options are also limited in production mode. For example, you can't enable or disable cache types through the Admin, but must use the command line to do this instead.

Maintenance mode

This is a special mode which temporarily restricts access to your site during updates, deployments, or configuration changes. When it is active:

  • Visitors are redirected to a "Service Temporarily Unavailable" page

  • The system creates a .maintenance.flag file in the var/ directory

  • You can configure IP address exceptions to allow access for specific users

When pushing out updates to your site, maintenance mode is typically activated within the deployment script while database upgrades and code compilation processes are being carried out. Then after a successful deployment, it’s toggled back off.

Welcome University student! You have extended access.

Learn more about this topic in the Magento 2 Coding Kickstart course:

View course →

Want to learn more about this topic?

It's covered in great detail within the Magento 2 Coding Kickstart course.

View course →
M Bytes Newsletter
Bi-weekly Magento deep-dives

Watch. Read. Apply. One topic every other week.

Fresh bytes every other Thursday. No spam. Unsubscribe anytime.


Join 9,000+ developers learning Magento, one byte at a time.