How to check if Magento is running in production mode or developer mode




If you want to know. your Magento 2 website is running on which environment you can run below command on terminal and very easily you can know which mode is active. 


php bin/magento deploy:mode:show

 Result "Current application mode: production. (Note: Environment variables may override this value.)"


But some time w set "set $MAGE_MODE developer" on server level. So it is very difficult to know that which mode is active on website. Because terminal will show you production and server level it set different. so you can easily know via below code programmatically which mode is active in your website.  

$om = \Magento\Framework\App\ObjectManager::getInstance();

/** @return \Magento\Framework\App\State */
$state = $om->get('Magento\Framework\App\State');
print_r($state->getMode());
It would help you to development. 

How to check if Magento is running in production mode or developer mode

If you want to know. your Magento 2 website is running on which environment you can run below command on terminal and very easily you can kn...

Popular Posts

Posts