1

I have an instance of Magento 2.2.3 on my development server, and my env.php file includes the following:

'system' =>
  array (
    'default' =>
      ...
      'web' =>
      array (
        'unsecure' =>
        array (
          'base_url' => 'https://my.dev.site/',
          'base_link_url' => '{{unsecure_base_url}}',
        ),
        'secure' =>
        array (
          'base_url' => '{{unsecure_base_url}}',
          'base_link_url' => '{{secure_base_url}}',
        ),
        'default' =>
        array (
          'front' => 'cms',
        ),
      ),
...

This env.php file is not versioned. My config.php file is versioned. However, when I run setup:upgrade or app:config:import, all 'system' values in env.php are merged with config.php's values, and stored in system_config_snapshot in the database's flag table.

This causes a 500 Internal Server Error when my colleague on a different server attempts to use her instance of Magento. The base_url in the configuration snapshot does not match her config, so she is forced to upgrade or import; which in turn causes my server to crash since my config no longer matches the snapshot.

My understanding of the env.php file is that it is system-specific, so I'm not sure why this one section of the file ('system') is getting extracted and merged with config.php's values in the database's config snapshot. Does anyone have any ideas?

  • Can you share your config.php and env.php completely (hide sensitive data)? I cannot reproduce your problem – Giuseppe Morelli Jun 14 '18 at 13:41
  • Regrettably, no. I've already dumped and reinstalled my Magento 2 instance in order to move on to other problems. I haven't yet tried to replicate the problem, so I don't know whether or not it will recur (though I suspect it will). I can say that one of my colleagues believes that the problem might stem from each of our Magento instances using the same database, rather than each instance having its own. This would be quite the change from M1, so I'm not sure what to think about that. You? – Nathan Casebolt Jun 14 '18 at 14:02
0

I have the same issue and It seems related to only this specific override in env.php. I didn't found the underlying issue but a workaround:

  1. run setup:upgrade or app:config:import without the base_urls in the env.php that it goes succesfully.
  2. put back the base_urls in the env.php
  3. run setup:upgrade or app:config:import runs succesfully

What I noticed is that in the table flag, in the row with flag_code = system_config_snapshot, doesn't have the base_url mentioned when it works, it does when it doesn't work.

  • Thanks for the tip. I'm elbow-deep in another problem right now, but I'll give this a shot when I work back around to it. I'll credit your answer if it works for me. – Nathan Casebolt Jun 14 '18 at 18:55
  • Opened an issue github.com/magento/magento2/issues/16171 since I did a test on a clean installaton 2.2.3 and 2.2.4 and both have this issue. – springerin Jun 15 '18 at 15:51
  • Awesome. I just tried your suggestion on two installs of 2.2.3, and I'm still getting everything in the env 'system' override rolled into the snapshot. I'll keep an eye on that issue since you've already elevated it. – Nathan Casebolt Jun 15 '18 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.