Oct 10 2012

How to turn on error log / error reporting in PrestaShop ?

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.

 

If you have got newest prestashop (1.5.3 or higher) you need to read new tutorial - just click here

 

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:

Prestashop configuration config.inc.php file

 

you must open this file and edit one setting parameter:

1
@ini_set('display_errors', 'off');

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:

1
@ini_set('display_errors', 'on');

 

If you want advanced errors information (notices too) you should add new line:

1
error_reporting("E_ALL");


error_reporting parameter can have several settings, like:

 

Parameter valueDescription
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:

1
error_reporting("E_ALL");

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 :)

author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
  • Google+
  • Facebook ()
  • Disqus ()
comments powered by Disqus
Gift Cards - sell voucher codes modulesadvertising and marketing
29.99 € 24.99 €
certificate code customer discount gift marketing promotion voucher This addon allows to create gift cards in your shop. Customers can order them and give as a gift for their friends / family etc. In module you can create as many gift cards as you want. It means that you can sell $25, $50, $100, $500, ... , promotional gift certificates - everything depends on you!
Facebook Fan Slider modulessocial networks
19.99 € 10.00 €
animated facebook marketing slider social media This prestashop module creates a special animated tab slide. Inside the sliding box module displays facebook like box plugin. This addon allows you to highly customize likebox. Facebook Fan Slider is a great marketing tool to increase number of likes on your fanpage
Facebook Login Connect modulessocial networks
10.00 €
connect customer facebook login registration social media This prestashop module allows to create special login button on your website. With this button your customers can log in to your shop with their facebook account. Module creates customer account automatically, with filled fields like First name, Last name etc. It's a great way to improve and let your customers to easily create accounts in your shop.
Rewards - Voucher codes after orders modulesadvertising and marketing
29.99 € 26.99 €
affiliate code coupon customer discount marketing orders voucher This module allows to automatically generate voucher code after customer order (and if order is accepted, with verified payment). Addon allows to specify voucher code settings and allows to create many kind of actions like: voucher for first order, voucher for second order, fith, sixth etc. You can define each voucher code specification.
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery developer discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim

Let's talk about ...