When working with Magento, it’s common to see a message like Exception Printing is Disabled by Default for Security Reasons.

However, this is not an error but a notification tells that Exception Printing is currently disabled on the system.

By enabling this we can see the actual error happens in the Magento system. Mainly, it happens due to a corrupt database, outdated modules, and much more.

That’s why, at Bobcares, we often get requests from our customers to fix problems related to exception printing as part of our Server Management Services.

Today, we’ll see the reasons for this notification and how our Support Engineers fix exception printing problems on Magento servers

 

Reasons to occur “Exception Printing is Disabled

Basically, it’s not a bug or error message, but a message that notifies exception printing has disabled on the Magento server. Mostly, this message occurs on the website due to database problems and conflict in themes, extensions or if any errors happen with the installation of Magento.

The website shows the message like,

 

 

How to Enable Exception Printing in Magento

To identify the exact problem, our Support Engineers enable Exception Printing in Magento servers. Here, let’s see how we enable this on Magento 2 server.

1. We login into the server a root user.

2. Then, locate the file pub/errors/local.xml.sample and rename the file local.xml.sample to local.xml.

3. Now, we can see a clear error message instead of Exception Printing is Disabled by Default for Security Reasons.

4. Also, we collect the detailed report from var/report/ and find the Error log record number file.

 

Sometimes, we use the following command to enable developer mode to display error in detail.

php bin/magento deploy:mode:set developer

Then, we clear the cache and refresh the page to see the error.

In cPanel, we can use File manager to change local.xml.sample to local.xml on the Magento server.

 

Common errors and how we fix it

Depending on the error message from the var/report/ file, we apply different methods to solve the error

Let’s take a closer look at how our Support Engineers fix these problems.

 

1. Outdated modules

Recently, one of our customers had an error while importing a database to the Magento server. The error displayed on the interface was,

There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 186016207762.

Then, our Support Engineers changed “pub/errors/local.xml.sample to “pub/errors/local.xml

As a result, we found detailed error messages displayed in the browser as,

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory.
The following modules are outdated:
Mageplaza_Core schema: current version - none, required version - 1.0.0
Mageplaza_Core data: current version - none, required version - 1.0.0
Mageplaza_LayeredNavigation schema: current version - none, required version - 2.0.0
Mageplaza_LayeredNavigation data: current version - none, required version - 2.0.0

 

This error occurs when we didn’t upgrade the database after installing/deleting Magento 2 plugins.

Therefore, we execute the following command on the Magento’s root directory to update the database schema.

bin/magento setup:upgrade

And, we flush the cache.

Now, the customer could access his Magento store without any problem.

 

2. Change in database credentials

Sometimes, we find the following error after enabling Exception Printing on the Magento server, because of the wrong database username and password. Often, the database credentials may change due to software update.

a:4:{i:0;s:90:"SQLSTATE[28000] [1045] Access denied for user 'xxx'@'localhost' (using password: YES)";i:1;s:2473:"#0 /home/xxx/public_html/lib/Zend/Db/Adapter/Pdo/Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/xxx/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(396): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/xxx/public_html/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()

 

So. our Support Engineers open /app/etc/env.php and make sure that given database credentials are correct.

 

3. Database corruption

Similarly, another reason for this error can be database corruption too. Then, the following error will display in the browser.

(Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY', query was: INSERT INTO abc_table (customer_id, session_id, last_visit_at) VALUES (?, ?, ?)";i:1;s:13034:"#0

Here, our Support Engineers fixed this error by executing the following command to truncate the database table.

TRUNCATE abc_table;

 

[Getting error Exception Printing is Disabled by Default for Security Reasons? We’ll fix it for you.]

 

Conclusion

In short, often Exception Printing is Disabled by Default for Security Reasons error happens due to a corrupt database, outdated modules, or incorrect database credentials. Today, we saw different error variants and how our Support Engineers fix them.



Source link

Author

Write A Comment