If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

PrestaShop 1.5.x./1.6.x. How to enable Error Reporting (Debug Mode)

If you see white empty screen trying to access your PrestaShop store this means that there is some server error occurred.

Enabling errors display

1. First of all, you can enable built in Debug Mode of PrestaShop engine, open config\defines.inc.php file and locate the following line:

define('_PS_MODE_DEV_', false);

replace it with

define('_PS_MODE_DEV_', true);

Enabling errors logging

2. To log the errors without displaying them, you need to open index.php file from the root of your PrestaShop installation and at the top add the following code:

<?php error_reporting(0); 
$old_error_handler = set_error_handler("userErrorHandler");

function userErrorHandler ($errno, $errmsg, $filename, $linenum,  $vars) 
{
$time=date("d M Y H:i:s"); 
// Get the error type from the error number 
$errortype = array (1    => "Error",
2    => "Warning",
4    => "Parsing Error",
8    => "Notice",
16   => "Core Error",
32   => "Core Warning",
64   => "Compile Error",
128  => "Compile Warning",
256  => "User Error",
512  => "User Warning",
1024 => "User Notice");
$errlevel=$errortype[$errno];

//Write error to log file (CSV format) 
$errfile=fopen("errors.csv","a"); 
fputs($errfile,"\"$time\",\"$filename: 
$linenum\",\"($errlevel) $errmsg\"\r\n"); 
fclose($errfile);

if($errno!=2 && $errno!=8) {
//Terminate script if fatal error
die("A fatal error has occurred. Script execution has been aborted");
} 
}
?>

Save the file and try to access your PrestaShop store or admin panel.

After this you’ll be able to see errors.csv file created on your server. It contains the log of the occurred errors.


  • Ralph Stirrat

    hi were are the csv files located?

    No votes yet.
    Please wait...
    • Alex Ross

      It should be available at the same folder as your index.php file.

      No votes yet.
      Please wait...
  • shmm

    Спасибо, смог найти ошибку:

    Перенес prestashop с хостинга на xampp, все сделал правильно, кроме настройки юзера в MySql.

    Проблема решилась после того, как для юзера БД поставил Хост = localhost вместо “%” (“Привелегиях > Информация учетной записи > Хост”)

    No votes yet.
    Please wait...
  • shmm

    Спасибо, нашел ошибку – неправильно был настроен юзер БД.

    No votes yet.
    Please wait...
 
Live Chat
We help you to choose the right product.
Start chat