Skip to content
English
  • There are no suggestions because the search field is empty.

ShopPerformance - Shopware 6: Using .env.local.php

Starting with Shopware 6.4.8.0, Shopware supports writing settings directly to a .env.local.php file.

Please note: The information in this article refers exclusively to our ShopPerformance tool, which you can use to identify potential performance improvements in your online shop.

Background

As of Shopware 6.4.8.0 (https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks#.env.local.php) Shopware supports the settings to be written directly to an .env.local.php. This function is a Symfony Core feature (https://symfony.com/doc/current/configuration.html#configuring-environment-variables-in-production).This means that the .env file does not have to be parsed for each request.

However, as of May 2022, Shopware does not yet provide a way to automatically generate the .env.local.php. Also, the Symfony tool Flex is not shipped with Shopware.Currently, the .env.local.php must therefore still be generated manually.

Solution

Although Shopware does not yet offer the possibility to generate the .env.local.php automatically, it is still possible to use the .env.local.php file.

For this purpose, a corresponding file can be created based on the previous .env file. The syntax must be rewritten into a PHP array. A corresponding file can therefore look like the following:

<?php

return array (

       'APP_ENV' => 'prod',

       'APP_SECRET' => '***',

       'APP_URL' => 'http://sw6.c-421.maxcluster.net',

       'DATABASE_URL' => 'mysql://db-user-1:***@localhost:3306/db-1',

       'COMPOSER_HOME' => '/var/www/share/sw6.c-421.maxcluster.net/sw6/var/cache/composer',

       'INSTANCE_ID' => '***',

       'BLUE_GREEN_DEPLOYMENT' => '1',

       'SHOPWARE_HTTP_CACHE_ENABLED' => '1',

       'SHOPWARE_HTTP_DEFAULT_TTL' => '7200',

       'SHOPWARE_ES_HOSTS' => '',

       'SHOPWARE_ES_ENABLED' => '0',

       'SHOPWARE_ES_INDEXING_ENABLED' => '0',

       'SHOPWARE_ES_INDEX_PREFIX' => 'sw',

       'SHOPWARE_CDN_STRATEGY_DEFAULT' => 'id'

);

If you require any further assistance, please contact our support team by phone at +49 5251/414130 or by email at support@maxcluster.de