Symfony : File .env.local not taken into account

I have a problem with my project, since the beginning it seems that the .env.local is not taken into account. I have my .env like that:

APP_ENV=
APP_SECRET=secret

###> symfony/mailer ###
# MAILER_DSN=smtp://localhost
[email protected]
MAILER_URL=sendmail://localhost
###< symfony/mailer ###

###> symfony/ldap ###
LDAP_HOST=
LDAP_PASS=
LDAP_BASE_DN=
LDAP_SEARCH_DN=
LDAP_UID_KEY=sAMAccountName
LDAP_FILTER=(&(objectClass=Person)({uid_key}={username}))
###< symfony/ldap ###


 DATABASE_URL=mysql://root:[email protected]:3306/intranet?serverVersion=mariadb-10.3.22&charset=utf8

And then I want to override some vars so I did that in my .env.local:

APP_SECRET=secret

###> symfony/ldap ###
LDAP_HOST="blabla"
LDAP_PASS="blabla"
LDAP_BASE_DN="blabla"
LDAP_SEARCH_DN="blabla"
###< symfony/ldap ###

But when I try to access those vars, I get the one from my .env. I’ve tested various things, like the .env without the vars I need and define them only in the .env.local but then I get the error:

Environment variable not found: "LDAP_HOST".

I really have no idea why it is not working. While trying to debug, I actually lost my debug toolbar (like, it doesn’t appear anymore on my website) so I tried various thing to have it back:

composer require symfony/profiler-pack
composer require symfony/apache-pack

And even:

composer remove apache-pack
composer require symfony/apache-pack

But I still can’t have it back.
The main problem is my .env.local not working, but I also would like some help with my debug toolbar. Thanks a lot

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

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