symfony-cli / symfony-cli

The Symfony CLI tool
https://symfony.com/download
GNU Affero General Public License v3.0
509 stars 102 forks source link

Server runs in 'prod' environment. #448

Closed phtmgt closed 4 months ago

phtmgt commented 4 months ago

I know it sounds crazy, but I upgraded from symfony 6.3 to 6.4 and suddenly 'symfony serve' and 'symfony server:start' operate in 'prod' environment. .env file is correct (cli is in dev), tested all kinds of strategies (setting APP_ENV to 'dev' in front of the command and via terminal).

Nothing is working.

Of course, 'php -S 127.0.0.1:8000 -t public' works absolutely fine and serves 'dev' material. However, it does not work for me, because it's missing https support.

Version is 5.8.11

EDIT: 100% verified that it runs in 'prod' with both frontend via twig and with echo 'APP_ENV: ' . $_SERVER['APP_ENV']; in index.php

phtmgt commented 4 months ago

I finally found the issue and I have no idea how it happened. Anyway, leaving it here in case anyone is stuck similarly: For some unknown reason there was a .prod file in the root folder. No idea how it got there and I noticed it purely randomly. The bigger issue here is why Symfony CLI respects that file while neither the stock PHP server, nor symfony commands do. Some things are not meant to be known, I guess.