recipes: --env no longer equivalent to APP_ENV

Related to https://github.com/symfony/recipes/pull/491

These two should be equivalent, shouldn’t they?

> APP_ENV=prod APP_DEBUG=0 bin/console cache:clear --no-warmup
> bin/console cache:clear --no-warmup --env=prod --no-debug

Reproducer:

> composer create-project symfony/skeleton skeleton 
> cd skeleton
> rm -rf vendor
> composer install --no-dev #error will be here too.
> bin/console cache:clear --no-warmup --env=prod --no-debug

> Fatal error: Uncaught RuntimeException: The "APP_ENV" environment variable is not set to "prod". Please run "composer require symfony/dotenv" to load the ".env" files configuring the application. in project/src/.bootstrap.php on line 13

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (17 by maintainers)

Commits related to this issue

Most upvoted comments

@bendavies, I have the situation you describe. In my Dockerfile:

ENV APP_ENV "prod"
...
RUN bin/console cache:clear --no-warmup -vv --env=prod

And effectively in bootstrap.php my $_SERVER['APP_ENV'] is null so it tries to use DotEnv which is dev dependency. It is very counter-intuitive that --env=prod makes environment non-prod at some point.