{"id":15499,"date":"2013-10-01T05:43:25","date_gmt":"2013-10-01T09:43:25","guid":{"rendered":"http:\/\/info.template-help.com\/?p=15499"},"modified":"2016-03-16T06:29:06","modified_gmt":"2016-03-16T10:29:06","slug":"prestashop-troubleshooter-how-to-enable-server-errors-log","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/prestashop-troubleshooter-how-to-enable-server-errors-log.html","title":{"rendered":"PrestaShop 1.5.x.\/1.6.x. How to enable Error Reporting (Debug Mode)"},"content":{"rendered":"<p>\r\n<p>If you see white empty screen trying to access your PrestaShop store this means that there is some server error occurred. <\/p>\r\n<h3 class=\"custom\">Enabling errors display<\/h3>\r\n<p>1. First of all, you can enable built in <strong>Debug Mode<\/strong> of PrestaShop engine, open  <strong> config\\defines.inc.php<\/strong> file and locate the following line:<\/p>\r\n<pre class=\"brush:php\">define('_PS_MODE_DEV_', false);<\/pre>\r\n<p>replace it with <\/p>\r\n<pre class=\"brush:php\">define('_PS_MODE_DEV_', true);<\/pre>\r\n<h3 class=\"custom\">Enabling errors logging<\/h3>\r\n<p>2. To log the errors without displaying them, you need to open <strong>index.php<\/strong> file from the root of your PrestaShop installation and at the top add the following code:<\/p>\r\n<pre class=\"brush:php\">\r\n&lt;?php error_reporting(0); \r\n$old_error_handler = set_error_handler(&quot;userErrorHandler&quot;);\r\n\r\nfunction userErrorHandler ($errno, $errmsg, $filename, $linenum,  $vars) \r\n{\r\n$time=date(&quot;d M Y H:i:s&quot;); \r\n\/\/ Get the error type from the error number \r\n$errortype = array (1    =&gt; &quot;Error&quot;,\r\n2    =&gt; &quot;Warning&quot;,\r\n4    =&gt; &quot;Parsing Error&quot;,\r\n8    =&gt; &quot;Notice&quot;,\r\n16   =&gt; &quot;Core Error&quot;,\r\n32   =&gt; &quot;Core Warning&quot;,\r\n64   =&gt; &quot;Compile Error&quot;,\r\n128  =&gt; &quot;Compile Warning&quot;,\r\n256  =&gt; &quot;User Error&quot;,\r\n512  =&gt; &quot;User Warning&quot;,\r\n1024 =&gt; &quot;User Notice&quot;);\r\n$errlevel=$errortype[$errno];\r\n\r\n\/\/Write error to log file (CSV format) \r\n$errfile=fopen(&quot;errors.csv&quot;,&quot;a&quot;); \r\nfputs($errfile,&quot;\\&quot;$time\\&quot;,\\&quot;$filename: \r\n$linenum\\&quot;,\\&quot;($errlevel) $errmsg\\&quot;\\r\\n&quot;); \r\nfclose($errfile);\r\n\r\nif($errno!=2 &amp;&amp; $errno!=8) {\r\n\/\/Terminate script if fatal error\r\ndie(&quot;A fatal error has occurred. Script execution has been aborted&quot;);\r\n} \r\n}\r\n?&gt;<\/pre>\r\n<p>Save the file and try to access your PrestaShop store or admin panel. <\/p>\r\n<p>After this you&#8217;ll be able to see   <strong>errors.csv <\/strong> file created on your server. It contains the log of the occurred errors. <\/p>\r\n<p><br \/>\r\n<\/p>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>If you see white empty screen trying to access your PrestaShop store this means that there is some server error occurred.<\/p>\n","protected":false},"author":7,"featured_media":15500,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[732],"tags":[1477,1154,552,637],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/15499"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=15499"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/15499\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/15500"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=15499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=15499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=15499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}