Tuesday, October 18, 2022

[FIXED] How can I turn on the profiler in production mode (Symfony)?

Issue

I have a strange error. My Symfony app works fine in dev mode. But in production mode I am not able to save any files. So I need to turn on the profiler in production mode for a second to see what is the error. How can I achieve this?


Solution

Symfony profiler shouldn’t be in prod mode. Symfony docs : "Never enable the profiler in production environments as it will lead to major security vulnerabilities in your project."

You need to focus on your logs server. But if you want to do this.

  1. Create a web_profiler.yaml (.../config/packages/prod)

  2. Insert this content :

    web_profiler:
      toolbar: true
      intercept_redirects: false
    
    framework:
      profiler: { only_exceptions: false }
    
  3. Remove this after your found your problem

Regards



Answered By - Yohann Daniel Carter
Answer Checked By - Katrina (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.