Magento 2 Training : Unit 1 – Lesson C

Our Magento 2 installation is done, sample datas set up, we can begin to work on our development environment. Before, I recommand you to make some configuration in order to not waste time when you develop.

Disables caches

You can disable cache on the admin panel :

System > Tools > Cache Management

Select all, and disable all caches :

With caches, you can win time execution when your website is online. But during the development, it’s better to disable its. When you modify some configuration file or other things, you need to flush caches. Sometimes you forget it, and search why your module dosn’t work, and it’s because caches are enabled.

Server Configuration

I recommand you to add this config on your apache vhost :

    SetEnv MAGE_MODE "developer"

Your file looks like this :

<VirtualHost *:80>
    ServerName magento2.lan
    DocumentRoot /var/www/magento2
    SetEnv MAGE_MODE "developer"
    <Directory /var/www/magento2>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    ErrorLog ${APACHE_LOG_DIR}/magento2_error.log
    # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/magento2_access.log combined

Don’t forget to restart apache :

sudo service apache2 restart

Here are the possibilities for this parameter :

Mode name Description
developer Intended for development only, this mode:

default As the name implies, Magento operates in this mode if no mode is explicitly set. In this mode:

  • Static view file caching is enabled
  • Enables automatic code compilation
  • Exceptions are not displayed to the user; instead, exceptions are written to log files.
  • Hides custom X-Magento-* HTTP request and response headers

Although you can run Magento in default mode in production, we don’t recommend it.

production Intended for deployment on a production system. Exceptions are not displayed to the user, exceptions are written to logs only, and static files are not cached.



You can modify your PHP ini in order to show warning as error, and have a good quality for your code.
Parameters to set :

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = On

Retart apache

sudo service apache2 restart

All these modification above are only for development environment, don’t apply it on production !

Continue training
Return to previous lesson
Before Developping
Tagged on:             

Leave a Reply

Your email address will not be published. Required fields are marked *

We use cookies to ensure that we give you the best experience on our website.