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_dev.php. I also added a
Also, I tried to set environment variables as the following.
index.php is always loaded, and not
index_dev.php as I expected.
How I can fix this?
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.
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.