Understand and configure Magento modes

Magento works in different modes. The Bitnami Magento Stack enables “default” mode. These are the modes available:

  • Default: Enables you to deploy the Magento application on a single server without changing any settings. However, default mode is not optimized for production.

  • Developer: Intended for development only. It disables static view file caching, enables enhanced debugging and verbose loggind, which results in a slower performance.

  • Production: Intended for deployment on a production system. Exceptions are not displayed to the user, exceptions are written to logs only, and static view files are served from cache only. New or updated files are not written to the file system.

Find more details about modes in Magento’s official documentation.

In order to display the current mode, run the following command:

$ sudo /opt/bitnami/apps/magento/htdocs/bin/magento-cli deploy:mode:show

A message similar to the following will appear:

Current application mode: default.

To change to another mode, run this command replacing MODE with the “default”, “developer” or “production”

$ sudo /opt/bitnami/apps/magento/htdocs/bin/magento-cli deploy:mode:set MODE

Here’s an example that sets Magento to production mode:

$ sudo /opt/bitnami/apps/magento/htdocs/bin/magento-cli deploy:mode:set production

A message similar to the following will appear:

Enabled maintenance mode
Starting compilation

If changing from production mode to developer mode, delete the contents of the var/generation and var/di directories before setting the mode:

$ sudo rm -rf /opt/bitnami/apps/magento/htdocs/var/di/* /opt/bitnami/apps/magento/htdocs/var/generation/*
Last modification April 8, 2020