lechowski / 13.11.2021

Debug mode in PrestaShop just for us

Many times we need to do a debug on the site, and we find that there are errors everywhere, and if we see those errors, imagine the customers who visit our site. This can simply cause customers to decide NOT to buy from our store.

The solution is to enable debugging options by specifying our IP address, so that only we can see the errors. The first thing is to know our IP, sites like https://www.whatismyip.com do show our IP.

The second is to edit the config / defines.inc.php file and change this line:

if (!defined ('_PS_MODE_DEV_')) {
define ('_PS_MODE_DEV_', false);
}

by

if ($_SERVER['REMOTE_ADDR'] == '186.22.82.xxx') {
define ('_PS_MODE_DEV_', true);
}

/*Debug only*/
if (!defined ('_ PS_MODE_DEV_')) {
define ('_ PS_MODE_DEV_', false);
}

Where REMOTE_ADDR is our IP. With this only we will be able to see the errors of the site without having to put the site in maintenance.