Skip to content

PrestaShop debug mode: how to turn it on and off

· The AYT team · 5 min read

Woman in sunglasses holding many shopping bags

PrestaShop debug mode shows PHP errors right on the page, instead of a blank page or a 500 error. You activate it in the back office, under Advanced Parameters → Performance → Debug mode, or, when the back office won't open, by setting _PS_MODE_DEV_ to true in config/defines.inc.php. You disable it the same way, by setting the value back to false. On a live shop, keep it on only while you find the error: it slows the shop down and shows visitors technical details.

What debug mode does

With debug mode off, PrestaShop hides errors: the visitor sees an empty page or "500 Internal Server Error", and you learn nothing from the browser. With debug mode on:

  • PHP errors and warnings appear on the page, with the file and the line;
  • PrestaShop uses its development environment, with a separate cache in var/cache/dev;
  • failing SQL queries are shown with their text.

The official documentation warns that debug mode noticeably reduces performance, so turn it off when you're done.

Option 1: from the back office

Works when the back office opens.

  1. Log in to the back office.
  2. Go to Advanced Parameters → Performance.
  3. In the Debug mode section, set "Debug mode" to Yes.
  4. Save.
  5. Reload the page that showed the error and read the message.

The same section has "Disable all overrides", which turns off overrides. On the same page, the Modules section has a Disable button next to "Disable non built-in modules", which turns off every module that doesn't ship with PrestaShop (on 1.7 the option is called "Disable non PrestaShop modules" and sits in the Debug mode section). If the error goes away after one of them, you know where to look.

To disable debug mode, set "Debug mode" back to No and save.

Option 2: in config/defines.inc.php

Always works, including when the back office returns a 500 error.

  1. Open config/defines.inc.php in the shop's folder, with your host's File Manager or over FTP.
  2. Find the line:
define('_PS_MODE_DEV_', false);
  1. Change it to:
define('_PS_MODE_DEV_', true);
  1. Save the file and reload the problem page.

To disable it, put false back. The line sits inside an if (!defined('_PS_MODE_DEV_')) block; change only the value, not the code around it.

If you still see a blank page after the change, empty the var/cache folder (the contents of prod and dev) and try again. How to do that is in the article on clearing the PrestaShop cache.

Option 3: from the console (PrestaShop 8 and 9)

Since PrestaShop 8, the console has a dedicated command. From the shop's folder:

php bin/console prestashop:debug on
php bin/console prestashop:debug off
php bin/console prestashop:debug

The first turns debug mode on, the second turns it off, and the third tells you the current state. The command doesn't exist in PrestaShop 1.7.

How to read the error

The error shows the path of the file that stopped the page:

  • modules/modulename/...: a module. Disable or update it.
  • override/...: an override, usually added by a module. Use "Disable all overrides" to confirm.
  • themes/themename/...: the theme or an edited template.
  • Allowed memory size ... exhausted: PHP memory is too low.
  • Uncaught PDOException or Access denied for user: the database connection.

The fix for each cause is in the article on the PrestaShop 500 error.

For a slow shop: profiling

Next to _PS_MODE_DEV_, the same file has the _PS_DEBUG_PROFILING_ constant. Set to true, it makes PrestaShop add tables at the bottom of pages with the load time, the SQL queries and the time each module takes. On PrestaShop 8 you can also turn it on in the back office, with "Debug profiler" in the Debug mode section. It's the quickest way to see which module slows a page down. Like debug mode, turn it on only for a test and off right after. More on the causes of slowness in the article on the slow PrestaShop back office.

On a live shop: what to keep in mind

  • Keep debug mode on for as short a time as possible, ideally at a low-traffic hour.
  • If you can, reproduce the error on a staging copy, not on the live shop.
  • Error messages can show server paths, table names and module versions. For someone looking for a vulnerability, that's useful information.
  • After turning debug mode off, clear the cache so the shop goes back to its production cache.

Frequently asked questions

I turned debug mode on but still see no error. Why?

Either the error happens before PrestaShop reads defines.inc.php (an incompatible PHP version, for example), or the page is served from a server cache. Look in your host's error log and in var/logs/, where PrestaShop writes errors even with debug mode off.

Does debug mode affect SEO?

Indirectly: it slows pages down and can show errors Google sees. A few minutes don't matter, a few days do.

PrestaShop debug mode on AYT hosting

On AYT, for PrestaShop 8 shops, you have three options without SSH. On the Commands page of the PrestaShop Toolkit you run prestashop:debug on and prestashop:debug off. You edit config/defines.inc.php directly in the File Manager, which has a code editor. And the toolkit's Security page checks whether debug mode is off and turns it off with "Turn off debug mode", clearing the cache as well.

The Commands page in the PrestaShop Toolkit

Errors also show on the domain's Errors page, without turning debug mode on for the live shop, and for tests you have staging on a subdomain. See the app toolkits and the plans on the hosting page.

More articles

All articles