Solved: Exception Printing is Disabled by Default for Security Reasons in Magento 2

Ever faced an error of “Exception Printing is Disabled for Security Reasons” in your Magento 2 store?

If yes, keep reading, because the post explains the error, its cause and of course the solution 😃

What does Exception Printing is Disabled by Default for Security Reasons in Magento 2 means?

How to Enable Exception Printing in Magento 2

This message is a notification of an error, that isn’t displayed, to avoid system exploit.

It is a general error, usually occurring at the time of Magento 2 or extension update. You may face this error while installing a Magento 2 theme or module or anything goes wrong with cache folder.

The conflict between components like extensions or themes causes the “exception printing is disabled by default for security reasons” error in Magento 2.

Due to which, the Magento 2 cannot operate properly, living us developers in a mess!

But, we developers tend to find out the solution every time, isn’t it! 😎

Solution for Exception Printing is Disabled by Default for Security Reasons in Magento 2:

Go to folder pub/errors find file local.xml.sample

Rename the file local.xml.sample to local.xml in the same folder pub/errors

Also, set developer mode using the following command :

So, that’s it.

How to Enable Exception Printing in Magento 2

If you still have any doubts, do not hesitate to mention them in the Comments section below. I’d be happy to help.

Feel free to share the solution on social media with fellow developers 😊


Also Read:How to Throw Exception on Magento 2 Admin Save Configuration

(based on 20 Reviews)
Solved: Exception Printing is Disabled by Default for Security Reasons in Magento 2Author Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.


  • Hubert

    I had the same error message on my website and tried your suggestion.
    But now I will get only errors on my website.
    Hope you can help me that my site will work again.
    kindly regards.

    • Sanjay Jethva

      Hello Hubert,
      It seems like there is an error related to theme.
      You can try by checking at the location app/code/Rokanthemes/Themeoption/Observer/RefreshStyleObserver.php 58 line
      Moreover, you can try by giving 777 permission to pub/static.
      Also check the owner of the file or folder.
      Thank You

  • SoN

    Hello Sanjay

    I’m a totally newbie in magento. I have skills in linux, wordpress, macos but this is the first time I have a client with magento shop and I faced the same issue, once I tried to log in into the admin area. Once I entered user/pass I got the message “There has been an error processing your request. Exception printing is disabled by default for security reasons. Error log record number: 987882184e9b868db9638bdc913510ba0170905862fd2c0de2a3fd22116db31c”
    After a little research I came to your website for the solution. I need your help because:
    The owner of the website has no clue at all from technology. The previous dev got disappeared – and that’s why I offered to help him.
    I have full access to cpanel, hosting provider, everything. But I don’t have a local copy of it – as I see in your example- so to test it here first.
    Can you please guide me, to fix this issue, safely and only through cpanel, file manager and etc? SSH is not an option for now but if I must enable it, I can do it.
    Please I remind only through web/browser any solution you might have.
    Thank you so so much <3

  • andrea


    i have a problem. for error i set in backend in store —> store view
    i change the code

    code: default


    code: change name

    and when i save the site go in error

    is it possible set via SSh and change the code?

    • Sanjay Jethva

      Hello Andrea,
      No, it can not be done using SSH command, you can do it from database directly from ‘store’ table.
      Thank You

  • Ajo Sam

    Hi Sanjay,
    When I tried to turn off developer mode, the terminal showing that “jailshell: bin/magento: Permission denied”

  • C. Smith

    Thank You for the quick and simple fix – it helped me out a ton. 🙂

  • meghna sharma

    Hello Sanjay, after running this command issue has been solved but my site is opening very slow

  • François Villon

    Dear Sanjay,
    Very usefull tip, thank you ! It worked for me.
    Question: Once Magento is fully recovered, shall we revert the commands.
    Meaning to say, rename the file into local.xml.sample and undo developer mode ?
    What is your advise ?
    Best regards

    • Sanjay Jethva

      Thanks for the appreciation and I’m glad the solution was helpful to you.
      Now, as far as your question is concerned, yes you need to revert from the developer mode to the production mode.

  • Richard Wendrock

    What is the command to turn off developer mode

    • Sanjay Jethva

      Hello Richard,
      Take the site in the production mode using the below command:
      bin/magento deploy:mode:set production
      Thank you.

  • Naveen

    very helpful,

  • Dani

    Hi Sanjay,
    How can I do this below? with which programm?

    (Also, set developer mode using the following command :

    php bin/magento deploy:mode:set developer
    php bin/magento deploy:mode:set developer)

    Kind regards

    • Sanjay Jethva

      Hello Dani,
      Check the following:
      1. using SSH you can run this command
      2. also in c-panel if the terminal is available

      Thank you.

  • Mike Clarke

    Hello Sanjay,

    Unfortunately I’m lacking the skill sets to carry out the “Solution for Exception Printing”. Can you provide other options?

Leave a Reply

Your email address will not be published.