5

I have an existing project and just would like to know which files and what should I change to make visible the debug toolbar in the prod environment

3
  • Possible duplicate of Symfony: Showing the dev toolbar in "prod" environment Commented Sep 2, 2016 at 9:36
  • I am not in the same situation the other question implied, I just need the lines and files I need to change to show it. Commented Sep 2, 2016 at 9:48
  • 1
    @AlexanderGuz the answer is referring a different version of the framework Commented Sep 2, 2016 at 9:55

1 Answer 1

6

You should change in the AppKernel.php file in order to enable the bundle in the prod environment also and change the route moving from the routing_dev.yml to the routing.yml the bundle definition route. Then add the configuration in the config.yml also.

As Example:

AppKernel.php

        // Move this outside the if statement
        $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
        $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();

    if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
        $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
        $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
    }

routing.yml

#add this

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

config.yml

web_profiler:
    toolbar: true

Hope this help

Sign up to request clarification or add additional context in comments.

2 Comments

The site goes blank. Maybe the project has some changed files that make this not possible :x
hi @MatheusOliveira check my update. In case of error (blank page) check in the log files (app/logs/prod.log) for the exception. Let me know

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.