phpconfigurationsymfony6

Symfony 6.4 - How to use the prod environnement with custom APP_ENV


At my current company, when a project moves to the qualification phase before going into production, the environment variable APP_ENV is set to qual (which I can't change).

However, the error pages I've created don't appear; instead, the same error page as in the development environment is shown. In APP_ENV=qual, it needs to function exactly like APP_ENV=prod. How can I achieve this? I know I can use a controller, but after the qualification phase, APP_ENV will be set to prod.

My error pages are located in Templates/bundles/TwigBundle/Exception.

In the config/packages directory, I added a directory named 'qual' with all the necessary .yaml files and replaced when@prod with when@qual, but it didn't work. I tried following the official documentation, but I don't clearly understand what it's saying.

I want to create a new environment that works exactly like prod, or when the environment is set to 'qual', I want it to be changed to 'prod'.


Solution

  • Try setting the APP_DEBUG variable to false manually, as the Dotenv component automatically sets it to true when the APP_ENV variable is set to anything else other than "prod".