First, will be a good idea to check the current MODE:
1 2 3 |
php bin/magento deploy:mode:show |
The main idea is to have this (environment) variable MAGE_MODE set to one of this values:
- Default
- Developer
- Production
To change the MODE in Magento for the moment there are 3 ways:
- From CLI (you’ll be 100% sure it changed)
123456789101112131415161718# we are using the Magento deploy in order to change the mode# there are 3 possible values:# * default# * developer# * production## BUT there is a CATCH: once you changed# the DEFAULT mode you can NOT go back to it# make it into Developer modephp bin/magento deploy:mode:set developer# for Production modephp bin/magento deploy:mode:set production - Using the .htaccess file:
12345# add the following line in the main .htaccess fileSetEnv MAGE_MODE developer - Through your WEB Server (Apache or Nginx)
- This is an example for Apache , added in vhost file:
123456789101112131415161718#First 2 lines are just to give an idea where it should be located<VirtualHost 127.0.0.1:1900>ServerName localhost.com### THE MAIN LINE ###SetEnv MAGE_MODE "developer"############################If you're here you can add a#couple more linesSetEnv MAGE_RUN_TYPE "website"SetEnv MAGE_RUN_CODE "mage2_pro"</VirtualHost> - Nginx example
12345location ~ \.php$ {fastcgi_param MAGE_MODE "developer";}
- This is an example for Apache , added in vhost file:
Alternatively you also can set (on UNIX systems), the environment variable can also be set by exporting it into a shell before restarting the service:
1 2 3 |
export MAGE_MODE=developer |
NOTE: You can NOT go back to Default mode (in theory) once you changed it to production or developer but if you really want to go back then you could open this file:
1 2 3 |
app/etc/env.php |
and edit the following line:
1 2 3 4 5 6 7 8 9 |
<?php return array ( ... 'MAGE_MODE' => 'default', ... ); |