-
-
Notifications
You must be signed in to change notification settings - Fork 474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checking APP_* in $_SERVER var isn't suffisant #331
Comments
Do you have a reproducible case where |
In your case, it's because you override the env var in your I proposed symfony/symfony#25693 to see if we can fix this in the framework instead. For now, as a fallback you can use a more reliable method like this: if (!isset($_SERVER['APP_ENV'], $_ENV['APP_ENV']) && false === getenv('APP_ENV')) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}
$env = $_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? getenv('APP_ENV'); |
I can't understand. I have APP_ENV set to dev. And my .dot file is not loaded in this scenario. |
I believe this is resolved in #464 |
In file recipes/symfony/framework-bundle/3.3/public/index.php ,
checking APP_* in $SERVER var isn't suffisant, in certain docker context, APP* vars are set in entrypoint and must be checked by $_ENV var.
It would be usefull to check both vars in index.php .
The text was updated successfully, but these errors were encountered: