vlucas / phpdotenv

Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
BSD 3-Clause "New" or "Revised" License
13.15k stars 626 forks source link

loading a .env file from outside the webspace seem to not work #553

Closed ecxod closed 1 year ago

ecxod commented 1 year ago

This seem to not work :))) The .env file is in /home/user/.config/.env The Webspace is /home/user/webroot/public_html

// this code is in /home/user/webroot/public_html/index.php
$envfile = realpath(__DIR__ .'/../../.config/');    // is /home/user/.config/
$dotenv = Dotenv\Dotenv::createImmutable($envfile);