Closed robineero closed 2 years ago
Hi @robineero ! It's probably the same issue as the #137 : USER
and USERNAME
are probably already defined by another process. Try to write echo getenv('USERNAME')
before those 3 lines and look at the result.
To solve this, you have two choices :
USER_NAME
or a prefix like MYAPP_USERNAME
Dotenv::createMutable(__DIR__)
instead of Dotvenv::createImmutable(__DIR__)
- See https://github.com/vlucas/phpdotenv#immutability-and-repository-customizationCheers ✌️
Benjamin is correct. You likely already have those set, so mutable mode is skipping them. If you use $_SERVER
instead if $_ENV
, you should be able to see it. In any case, mutable mode will be what you want, if you need to override something already set in $_SERVER
.
I am having issues with .env index names.
USER
andUSERNAME
can not be used as index names? For some reason only these variables are not loaded from the .env and are therefore undefined.This results in
PHP Notice: Undefined index: USERNAME
but works well withUSER_NAME
and everything else.