In this article you will read something about debuging modules and other shop problems. This article should be taken as an introduction to self-troubleshooting in the own store. This tutorial works in all versions of prestashop, in 1.5 too.
What exactly is error log or error reporting?
If you are running into a white shop page or some other PHP error, if something doesn't work properly in your shop based on PrestaShop engine, if something is wrong with any presta module or addon - but you have no clue what is wrong, you should consider turning on PHP error reporting. This will give you some indication of where or what the problem is. This is a good first step to solving your problem. In simple words is a web server mode which provides you and other users to read about errors, warnings, notices in your website code. By default, in PrestaShop this feature is disabled for safety reasons. Here is how to turn on PHP errors in shops based on PrestaShop:
Open and edit config.inc.php file
Yyou first need to find the config.inc.php file in directory config in your main prestashop dir, exactly as we show on image below:
you must open this file and edit one setting parameter:
as you probably see and as we say, the display_errors value is set to off by default. You must turn it on. How to do that?
just change 'off' param to 'on' exactly as below:
If you want advanced errors information (notices too) you should add new line:
error_reporting parameter can have several settings, like:
|E_ERROR||Fatal run-time errors. Errors that can not be recovered from. Execution of the script is halted|
|E_WARNING||Non-fatal run-time errors. Execution of the script is not halted|
|E_PARSE||Compile-time parse errors. Parse errors should only be generated by the parser|
|E_NOTICE||Run-time notices. The script found something that might be an error, but could also happen when running a script normally|
|E_CORE_ERROR||Fatal errors at PHP startup. This is like an E_ERROR in the PHP core|
|E_CORE_WARNING||Non-fatal errors at PHP startup. This is like an E_WARNING in the PHP core|
|E_COMPILE_ERROR||Fatal compile-time errors. This is like an E_ERROR generated by the Zend Scripting Engine|
|E_COMPILE_WARNING||Non-fatal compile-time errors. This is like an E_WARNING generated by the Zend Scripting Engine|
|E_USER_ERROR||Fatal user-generated error. This is like an E_ERROR set by the programmer using the PHP function trigger_error()|
|E_USER_WARNING||Non-fatal user-generated warning. This is like an E_WARNING set by the programmer using the PHP function trigger_error()|
|E_USER_NOTICE||User-generated notice. This is like an E_NOTICE set by the programmer using the PHP function trigger_error()|
|E_STRICT||Run-time notices. PHP suggest changes to your code to help interoperability and compatibility of the code|
|E_RECOVERABLE_ERROR||Catchable fatal error. This is like an E_ERROR but can be caught by a user defined handle (see also set_error_handler())|
|E_ALL||All errors and warnings, except level E_STRICT (E_STRICT will be part of E_ALL as of PHP 6.0)|
Which parameter value we must use?
in our opinion the best for use is E_ALL
so set the parameter value to:
and save the config.inc.php file.
now you can refresh your shop, and you will see errors, warnings and notices from PHP script interpreter. Now you can localize issues in your code, module codes or something else with errors :)