When starting the server locally I executed the command symfony server:prod
using the Symfony Local Web Server which gives me to understand that I changed the state of the server environment to production.
Since then, each time I run the local server, it launches in prod
environment even if I define a APP_ENV=dev
environment variable.
How can I switch back to the environment defined in my .env
file?
Advertisement
Answer
Quick answer
Use symfony server:prod --off
Explanations
By default, the web server will read your Symfony .env
files to know which environment to use (using the APP_ENV
key).
The command symfony server:prod
will force the server to launch the prod
environment without considering your environment variables.
To disable this and keep using your environment variables, just use symfony server:prod --off