Symfony ignores / does not override values by .env.local file

Viewed 189
1 Answers

I had the same problem lately.

I found out, that since Symfony 5.4 there was added runtime option dotenv_overload what is set to false by default.

That is set over APP_RUNTIME_OPTIONS, what you can update by the documentation this way:

#public/index.php  
#bin/console  
  
$_SERVER['APP_RUNTIME_OPTIONS'] = [
    'dotenv_overload' => true,
];

Note: it is needed to update in 2 files bin/console for cli and public/index.php to enable .env.local overwritting.
Note2: the option dotenv_overload is missing for some reason in documentation though

Related