Search code examples
phpsymfonynginxsymfony-3.3symfony3

Symfony, don't show the debug bar when the paged is served from the built in server


I have a Symfony instance running on Linux with apache y NGINX. I'am starting the project using the built-in server:start command:

php bin/console server:start

Back to my browser, it loads me the Symfony start page but it also shows me the debug bar.

I have checked the config_dev.yml file and I think it is correct:

imports:
- { resource: config.yml }

framework:
    router:
        resource: '%kernel.project_dir%/app/config/routing_dev.yml'
        strict_requirements: true
        profiler: { only_exceptions: false }
web_profiler:
    toolbar: true
    intercept_redirects: false

However, if I try to access another route that I don't have, the debug bar is also shown:

route not found


Solution

  • You can access the prod env with:

    http://127.0.0.1:8000/app.php

    And accessing http://127.0.0.1:8000/app.php/a will give you an error page without the debug bar.

    It is designed like this because the Symfony built-in web server is only meant to be used in development not in production. So the default environment is the "dev" one.