How to Enable & Disable PrestaShop Debug Mode?

How to Enable & Disable PrestaShop Debug Mode?

The debug mode is a feature that allows you to see the error messages and the stack trace of the functions that were executed before the error occurred. This can help you identify and fix the problem faster and more efficiently.

In this article, we will show you how to enable and disable the debug mode in PrestaShop using two different methods: via the back office and via the FTP.

How to Enable & Disable PrestaShop Debug Mode via the Back Office

The easiest way to enable and disable the debug mode in PrestaShop is to use the back office option, if you still have access to it. Once this mode is enabled, some error indicators will appear at the bottom of the page.

To access this option, go to Advanced Parameters > Performance > Debug Mode > Yes > Save.

To disable the debug mode, you just have to click on the bug icon at the top of the page, then put the button back to the No position, and save.

Please note: this type of debug mode can cause error messages to appear on the front office of your store, visible to any user. To avoid this, you can put your store in maintenance mode, or use the FTP method to enable the debug mode based on your IP address.

How to Enable & Disable PrestaShop Debug Mode via the FTP

Another way to enable and disable the debug mode in PrestaShop is to use the FTP method and edit some files in your store folder. This method is useful if you don’t have access to your back office or if you want to limit the visibility of the error messages to your own IP address.

To use this method, you need to access your FTP server and find the file /config/defines.inc.php. In this file, look for the following lines:

/* Debug only */
if (!defined(‘PS_MODE_DEV‘)) {
define(‘PS_MODE_DEV‘, false);
}

To enable the simple debug mode, you just have to replace the value “false” by “true”. This is the same type of debug mode as the one available on the back office.

/* Debug only */
if (!defined(‘PS_MODE_DEV‘)) {
define(‘PS_MODE_DEV‘, true);
}

To avoid displaying error messages on your front office, you can opt for a debug mode based on your IP address. This way, only you will be able to see them when browsing your store. To do this, replace the value “false” by a condition that checks your IP address.

/* Debug only */
if (!defined(‘PS_MODE_DEV‘)) {
define(‘PS_MODE_DEV‘, $_SERVER[‘REMOTE_ADDR’] == “YOUR IP” || $_SERVER[‘HTTP_X_REAL_IP’] == “YOUR IP”);
}

You can find your IP address by using a tool like https://www.whatismyip.com/.

\uD83D\uDCA1 Please note: any modification on your store files can cause irreversible errors. Don’t forget to make regular backups, and if you have any doubt, don’t edit your files by yourself.

PrestaShop debug mode is a handy tool that can help you troubleshoot and fix errors or issues that may occur on your online store. It allows you to see more detailed information about the error and its location in the code.

You can enable and disable the debug mode in PrestaShop using two different methods: via the back office or via the FTP. The back office method is easier and faster, but it may display error messages on your front office that are visible to any user. The FTP method is more complex and requires editing some files, but it allows you to limit the visibility of the error messages to your own IP address.

We hope this article helped you learn how to enable and disable PrestaShop debug mode for your online store. If you have any questions or comments, feel free to leave them below.

Heinz Avatar

Leave a Reply

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