Reputation: 3343
I have a weird issue with Symfony, in my local environment when I run symfony server:start
it's taking production configuration not dev configuration.
I have two index files in the public folder index.php
and index_dev.php
. I also added a .env.local
with APP_ENV=dev
Also, I tried to set environment variables as the following.
export SYMFONY_ENV=dev
But index.php
is always loaded, and not index_dev.php
as I expected.
How I can fix this?
Upvotes: 1
Views: 785
Reputation: 47444
It seems you are copying the app_dev.php
pattern, which is how it used to be in olden times (up to Symfony 3).
Fortunately, that's no longer how things are done. Since Symfony 4, you should have a single front-controller.
All requests should go through the same entry script (index.php
, generally), and there you can implement whatever logic you need taking into account the different environments.
The default index.php
file already has some logic to account for the APP_DEBUG
environment variable being set, you could always modify this file to add other behaviour depending on the environment.
Upvotes: 3