Display PrestaShop Error Messages Tutorial

How to show PrestaShop error messages and debug a PrestaShop error while developing a PrestaShop theme or module, instead of blank screens!

While working on your store, you may come across a PrestaShop error. While developing in PrestaShop (or PHP in general) accidental errors can occur, and instead of seeing the store you expected, you see a blank white screen.

This is very difficult to debug, as the PrestaShop error could be caused by missing a single ; character in one of the thousands of files in your PrestaShop store.

Luckily, you can enable a debugging mode and display PrestaShop error messages to quickly track down and deal with the PrestaShop error and solve the problem fast!

Enable PrestaShop error messages

Locate on your computer, or directly from your web server's FTP, the file config/config.inc.php in your store's directory, and scroll down to line 28:

/* Debug only */
@ini_set('display_errors', 'off');
define('_PS_DEBUG_SQL_', false);

Replace this with the following:

/* Debug only */
@ini_set('display_errors', 'on');
define('_PS_DEBUG_SQL_', true);

Now instead of seeing a blank screen when a PrestaShop error happens, PHP will tell you exactly where the problem occurred, and sometimes even offer you a solution!

PrestaShop error message

As you can see from the image above, our new configuration settings have enabled PrestaShop error messages. This is actually the same error shown in the original image at the start of this post, but now PrestaShop and PHP offer us with some useful information helping us debug the problem.

The problem is actually a single missing ; in the BlockCart module. Previously, without the help of the PrestaShop error message this could have taken hours to solve!

Remember to turn debugging off when putting your store is live. These settings are only meant for development. PrestaShop error messages could worry your customers and be a security risk.

PrestaShop error messages in older versions

This method works for PrestaShop stores using version 1.3 or above.

For older versions of PrestaShop find @ini_set('display_errors', 'off'); within config/config.inc.php in your store's directory, and set to 'on'

You find out more information about error reporting on PHP's official website.