“Exception Printing Is Disabled By Default For Security Reasons” Error In Magento 2

exception printing error

“Exception printing is disabled by default for security reasons” – this is another common error that Magento users can run into after installing new themes/extensions, settings configuration, or even when the server is overloaded. Similar to the message “There has been an error processing your request”, this isn’t an issue itself, but a notification for the user. In order to figure out the details and see the exact issue, follow this guide.

exception printing is disabled by default for security reasons magento 1

Clarify “Exception Printing Is Disabled By Default For Security Reasons” Message

As mentioned, the notification can pop up after the installation of new extensions or configurations, as these actions lead to internal conflicts in the system. Magento 2 doesn’t show the full error message as your system may then face attacks.

The quickest way to do this is by following these steps:

Step 1: Switch to developer mode to access Magento 2 folders

php bin/magento deploy:mode:set developer

Step 2: Locate the /pub/errors folder

Step 3: Find and change the name of the file local.xml.sample to local.xml

there has been an error processing your request magento

Step 4: Refresh the site and you should see the full error now. For instance, the result will be something like this:

there has been an error processing your request magento

With the exact issue displayed, you can go and debug it.

There are similar errors that you’ll encounter when configuring in the Magento backend:

a:4:{i:0;s:46:"SQLSTATE[HY000] [1049] Unknown database 'ce21'";i:1;s:4514:"#0 \vendor\magento\zendframework1\library\Zend\Db\Adapter\Pdo\Mysql.php(111): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 \vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(340): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 \vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(861): Magento\Framework\DB\Adapter\Pdo\Mysql->_connect()
#3 \vendor\magento\zendframework1\library\Zend\Db\Adapter\Abstract.php(931): Zend_Db_Adapter_Abstract->quote('1', NULL)
#4 \vendor\magento\framework\DB\Adapter\Pdo\Mysql.php(1363): Zend_Db_Adapter_Abstract->quoteInto('`store`.`store_...', '1', NULL, NULL)
#5 \vendor\magento\zendframework1\library\Zend\Db\Select.php(1007): Magento\Framework\DB\Adapter\Pdo\Mysql->quoteInto('`store`.`store_...', '1', NULL)
#6 \vendor\magento\zendframework1\library\Zend\Db\Select.php(477): Zend_Db_Select->_where('`store`.`store_...', '1', NULL, true)
#7 \vendor\magento\framework\DB\Select.php(115): Zend_Db_Select->where('`store`.`store_...', '1', NULL)
#8 \vendor\magento\framework\Model\ResourceModel\Db\AbstractDb.php(367): Magento\Framework\DB\Select->where('`store`.`store_...', '1')
#9 \vendor\magento\module-store\Model\ResourceModel\Store.php(168): Magento\Framework\Model\ResourceModel\Db\AbstractDb->_getLoadSelect('store_id', '1', Object(Magento\Store\Model\Store\Interceptor))
#10 \vendor\magento\framework\Model\ResourceModel\Db\AbstractDb.php(341): Magento\Store\Model\ResourceModel\Store->_getLoadSelect('store_id', '1', Object(Magento\Store\Model\Store\Interceptor))
#11 \var\generation\Magento\Store\Model\ResourceModel\Store\Interceptor.php(89): Magento\Framework\Model\ResourceModel\Db\AbstractDb->load(Object(Magento\Store\Model\Store\Interceptor), '1', NULL)
#12 \vendor\magento\framework\Model\AbstractModel.php(531): Magento\Store\Model\ResourceModel\Store\Interceptor->load(Object(Magento\Store\Model\Store\Interceptor), '1', NULL)
#13 \vendor\magento\module-store\Model\Store.php(488): Magento\Framework\Model\AbstractModel->load('1', NULL)
#14 \var\generation\Magento\Store\Model\Store\Interceptor.php(24): Magento\Store\Model\Store->load('1', NULL)
#15 \vendor\magento\module-store\Model\StoreRepository.php(89): Magento\Store\Model\Store\Interceptor->load('1')
#16 \vendor\magento\module-store\Model\StoreRepository.php(103): Magento\Store\Model\StoreRepository->getById('1')
#17 \vendor\magento\module-store\Model\StoreResolver.php(167): Magento\Store\Model\StoreRepository->getActiveStoreById('1')
#18 \vendor\magento\module-store\Model\StoreResolver.php(105): Magento\Store\Model\StoreResolver->getDefaultStoreById('1')
#19 \vendor\magento\module-store\Model\StoreManager.php(151): Magento\Store\Model\StoreResolver->getCurrentStoreId()
#20 \vendor\magento\module-store\App\Request\PathInfoProcessor.php(39): Magento\Store\Model\StoreManager->getStore('')
#21 \vendor\magento\module-backend\App\Request\PathInfoProcessor.php(47): Magento\Store\App\Request\PathInfoProcessor->process(Object(Magento\Framework\App\Request\Http), '/')
#22 \var\generation\Magento\Backend\App\Request\PathInfoProcessor\Proxy.php(95): Magento\Backend\App\Request\PathInfoProcessor->process(Object(Magento\Framework\App\Request\Http), '/')
#23 \vendor\magento\framework\App\Request\Http.php(165): Magento\Backend\App\Request\PathInfoProcessor\Proxy->process(Object(Magento\Framework\App\Request\Http), '/')
#24 \vendor\magento\framework\HTTP\PhpEnvironment\Request.php(209): Magento\Framework\App\Request\Http->setPathInfo()
#25 \vendor\magento\framework\App\Request\Http.php(208): Magento\Framework\HTTP\PhpEnvironment\Request->getPathInfo()
#26 \vendor\magento\framework\App\Http.php(130): Magento\Framework\App\Request\Http->getFrontName()
#27 \vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
#28 \index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#29 {main}";s:3:"url";s:6:"/ce21/";s:11:"script_name";s:15:"/ce21/index.php";}

Cache issue

a:5:{i:0;s:71:"Could not determine temp directory, please specify a cache_dir manually";i:1;s:4546:"#0 /home/host/domains/example.com/public_html/lib/Zend/Cache/Backend.php(197): Zend_Cache::throwException('Could not deter...')

Session issue

Warning: SessionHandler::read(): open(/var/lib/php/session/sess_cvevqn06desuj80, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/[site]/httpdocs/vendor/magento/framework/Session/SaveHandler.php on line 74

Registry issue

a:5:{i:0;s:63:"Mage registry key "_singleton/megamenu/observer" already exists";i:1;s:2654:"#0 /home/host/public_html/magento2/app/Mage.php(223): Mage::throwException('Mage registry k...')
#1 /home/host/public_html/magento2/app/Mage.php(477): Mage::register('_singleton/mega...', false)
#2 /home/host/public_html/magento2/app/code/core/Mage/Core/Model/App.php(1335): Mage::getSingleton('megamenu/observ...')
#3 /home/host/public_html/magento2/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('core_layout_blo...', Array)
#4 /home/host/public_html/magento2/app/code/core/Mage/Core/Model/Layout.php(459): Mage::dispatchEvent('core_layout_blo...', Array)
#5 /home/host/public_html/magento2/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('page/html', 'root')
#6 /home/host/public_html/magento2/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('page/html', 'root')
#7 /home/host/public_html/magento2/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#8 /home/host/public_html/magento2/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#9 /home/host/public_html/magento2/app/code/core/Mage/Cms/Helper/Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#10 /home/host/public_html/magento2/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#11 /home/host/public_html/magento2/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#12 /home/host/public_html/magento2/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()
#13 /home/host/public_html/magento2/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#14 /home/host/public_html/magento2/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#15 /home/host/public_html/magento2/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#16 /home/host/public_html/magento2/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#17 /home/host/public_html/magento2/index.php(84): Mage::run('', 'store')
#18 {main}";s:3:"url";s:19:"/magento2/";s:11:"script_name";s:28:"/magento2/index.php";s:4:"skin";s:7:"default";}

Note: If you are using Magento 1, the approach is the same. You can debug this by changing the file name to local.xml in Magento directory.

Wrap Up

So you now understand why the message “Exception printing is disabled by default for security reasons” was sent by the system and how to easily solve it. Whether you are using Magento 2 or still on Magento 1, you can easily check the notification for the exact errors to fix.

We hope that this tutorial was useful for you. Follow us for more informative tutorials about Magento 2!

Leave a Reply

Your email address will not be published. Required fields are marked *