0
votes

I would like to deploy my Symfony project in production on shared OVH server but it's not possible to define the APP_ENV environment variable on this type of server.

I get this error :

Fatal error: Uncaught 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. in /home/ovhpseudo/www/nameofsite/public/index.php:13 Stack trace: #0 {main} thrown in /home/ovhpseudo/www/nameofsite/public/index.php on line 13

Is it possible to circumvent this without changing offer ? Do we have to use this environment variable?

Thanks in advance

1
You can set environment variables in a .env file. Have you tried that? See the docs.ehymel

1 Answers

0
votes

I solved my problem with this tutorial : https://symfonycasts.com/screencast/symfony-fundamentals/env-vars-tricks-production .

composer remove symfony/dotenv

and

composer require symfony/dotenv

have solved my problem