1

Sorry for the beginner's question, but i never completely understood how to load the dotenv library.
I have a project where the index page lies in the root directory but some other pages at the /pages directory.
The first question is if I have to call the (new Dotenv\Dotenv(__DIR__))->load(); line in all pages where i'll use env variables. And the second question is how to call them from the other pages sitting in the /pages directory.
Last question: isn't there a way to load automatically the environmental variables in the whole app???

Thanks in advance

Marcos Di Paolo
  • 527
  • 1
  • 5
  • 22
  • Are you completely dead-set on using dotenv or would you be willing to use `$_ENV` instead? https://stackoverflow.com/questions/12760375/reading-user-environmental-variable-in-php – Daniel Gray Nov 04 '18 at 00:21

0 Answers0