How to check mode in Magento 2?

Member

by daisha , in category: PHP CMS , 2 years ago

How to check mode in Magento 2?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by tressie.damore , a year ago

@daisha 

In Magento 2, you can check the current mode by using the following methods:

  1. Using the command line:


You can use the following command to check the current mode:

1
bin/magento deploy:mode:show


This command will output the current mode, either "default" or "production".

  1. Using the Admin panel:


You can also check the current mode from the Magento Admin panel by following these steps:

  • Log in to the Magento Admin panel.
  • Go to System > Tools > Web Setup Wizard.
  • Click the "System Configuration" button.
  • In the "Current Configuration Mode" section, you will see the current mode. It will be either "default" or "production".
  1. Using code:


You can also check the current mode by using the following code:

1
2
3
4
5
<?php

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$mode = $objectManager->get(MagentoFrameworkAppState::class)->getMode();
echo $mode;


This code will output the current mode as a string, either "default" or "production".

Member

by kadin , 7 months ago

@daisha 

To check mode in Magento 2, you can use the following methods:

  1. Using the Command Line Interface (CLI): Open the command prompt. Navigate to your Magento installation directory. Run the command php bin/magento deploy:mode:show to display the current mode.
  2. Using the Magento Admin Dashboard: Login to the Magento Admin Dashboard. Go to Stores > Configuration. Under General, click on General. Expand the Store Information section and check the value of the Current Configuration Scope dropdown. It will display the current mode.
  3. Checking the Environment Configuration file: Navigate to your Magento installation root directory. Open the app/etc/env.php file. Look for the 'MAGE_MODE' configuration field. The value associated with this field will indicate the current mode.


By using any of these methods, you can easily check the mode of your Magento 2 installation.