Get Free Audit

Showing PHP And SQL Errors And Debugging a Blank White Page In Prestashop

May 14, 2013

5137 Sergei Guk

We all make mistakes while developing and need to know where is the error occurred, but Prestashop will show the blank/white screen in case of any issues.

To activate a debug mode for Prestashop versions < 1.5.3 you need to open config/config.inc.php and find the following lines:


Then change ‘off’ to ‘on’ and false to true, like this:


Besides, if you have the 500 error page you need to edit config/defines.inc.php and define _PS_MODE_DEV_ to true as will be described below.

In Prestashop 1.5.3+ you need to edit config/defines.inc.php. Find the following line


and change it to

Igor Dragun
Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Igor


What this will do? There is an ‘if’ loop below this line


As you can see, if _PS_MODE_DEV_ constant is defined, Prestashop will display not only PHP and SQL errors but also compatibility warnings.

I believe this will probably be enough for you to resolve a blank white page. Remember to turn debugging off when putting your store to live or after you fixed your errors.

Igor Dragun
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Igor

7 Comments

  1. Hi El Patron,
    glad that you read our blog (actually I’m a fan of yours in prestashop forums ;) )

    Post is updated, hope it’s more clear now

  2. Hi, thanks for all you do. The following is incorrect:
    To activate a debug mode for Prestashop versions up to 1.5.3

    Should read
    To activate a debug mode for Prestashop versions below 1.5.3

  3. Please guide me i am having below errors while i save cms page.
    thanks wonderful team.

    [PrestaShopDatabaseException]

    Table ‘ocsconne_snzuby.ocs_belvg_cms_search_index’ doesn’t exist

    DELETE FROM ocs_belvg_cms_search_index WHERE id_cms IN (36)

    at line 607 in file classes/db/Db.php
    601. WebserviceRequest::getInstance()->setError(500, ‘[SQL Error] ‘.$this->getMsgError().’. From ‘.(isset($dbg[3][‘class’]) ? $dbg[3][‘class’] : ”).’->’.$dbg[3][‘function’].'() Query was : ‘.$sql, 97);
    602. }
    603. else if (_PS_DEBUG_SQL_ && $errno && !defined(‘PS_INSTALLATION_IN_PROGRESS’))
    604. {
    605. if ($sql)
    606. throw new PrestaShopDatabaseException($this->getMsgError().”.$sql.”);
    607. throw new PrestaShopDatabaseException($this->getMsgError());
    608. }
    609. }
    610.
    611. /**
    DbCore->displayError – [line 307 – classes/db/Db.php] – [1 Arguments]
    DbCore->query – [line 447 – classes/db/Db.php] – [1 Arguments]
    DbCore->execute – [line 72 – override/classes/CMS.php] – [1 Arguments]
    CMS::indexation – [line 43 – override/classes/CMS.php] – [2 Arguments]
    CMS->update – [line 763 – classes/ObjectModel.php] – [1 Arguments]
    ObjectModelCore->toggleStatus – [line 349 – controllers/admin/AdminCmsController.php] – [0 Argument]
    AdminCmsControllerCore->postProcess – [line 121 – controllers/admin/AdminCmsContentController.php] – [0 Argument]
    AdminCmsContentControllerCore->postProcess – [line 158 – classes/controller/Controller.php] – [0 Argument]
    ControllerCore->run – [line 349 – classes/Dispatcher.php] – [0 Argument]
    DispatcherCore->dispatch – [line 50 – snzuby17/index.php] – [0 Argument]

  4. Hello Sergei,
    I run PS v1.5.4.1
    And have turned the things on, for php error reporting.
    But I have the follow prob, when I in the BO, click on the tab Advance parameters, Configuration information, I receive a blank, white page, and when I turn dev tools on, on Chrome, the follow message can I see,

    Request Method:GET
    Status Code:503 Service Unavailable
    Request Headersview source
    Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Encoding:gzip,deflate,sdch
    Accept-Language:en-US,en;q=0.8,nl;q=0.6
    Connection:keep-alive
    Cookie:jirafe.metric.boxes=%7B%22revenue%22%3A%7B%7D%2C%22orders%22%3A%7B%7D%2C%22visits%22%3A%7B%7D%2C%22conv_rate%22%3A%7B%7D%2C%22aov%22%3A%7B%7D%2C%22rpv%22%3A%7B%7D%7D; jirafe.active.site_id=129520; cookie_ue=1; ffdbd13d96d903c026c4876e97eb63a4=22hq01YtzSw%3DnJc1UVrJBZs%3Ds1R%2F%2FVTI8ok%3D7G5eLCXwBi0%3DFNXio%2BHVa%2Fw%3DWKfUm8UQITo%3DGL8FikPgbNE%3DeXA7gMVHM%2B4%3DO2PS22CZQ9I%3DkzX3DRsKB7Y%3DjNbhNcJXmW8%3D7xqWfoMgcN0%3Dv%2FSEcDgtUbY%3DZbi5bx79XiQ%3DDh2xOv8j5jg%3DgBXHGAq8L%2BE%3Dr4tCYsoDURo%3DK700IJSo1x0%3D000137; 44c621219e3f66a7d4725c437c8fb0f8=22hq01YtzSw%3DnJc1UVrJBZs%3DoOerxDIQ3iE%3DkZSJARK4hlM%3DFNXio%2BHVa%2Fw%3D4GSbjdlMn%2F8%3DKl0sZH9rT1M%3DsXtwVum1VJw%3DRrDntAqQnug%3Dlc%2BnYrTebmM%3DFVjNbJd4Esg%3D3s1qvjGC5lA%3DpxZHfpVJXtY%3D8yj4%2BAhPTy0%3DTmHTd1Qa%2F58%3Dl8oSeFgYZYU%3D%2F7Wk2H7CqnM%3D5%2Fk73gytZ4A%3DRKCKwDXu38Q%3Dp6e6KOoJwQI%3Di5wuYCBYZgw%3DvnIHwTdcqo4%3DKLKlbrISFk4%3DUw%2FoCXVEMhE%3D7Od%2BDTAr4bA%3DWKfUm8UQITo%3DGL8FikPgbNE%3DcDwUB8t10o0%3D1D0ub9BBRYE%3DGYRNGzxlN64%3DeRS%2B8HqFDFY%3Dz2446%2Ftt1xk%3DyksKdMSA6Ik%3Dn0rJCLVhbpI%3DnOGSxnbkbCQ%3D000276; __utma=20860524.1918701170.1370792655.1371236143.1371241892.37; __utmb=20860524.16.9.1371242239421; __utmc=20860524; __utmz=20860524.1370792655.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _pk_id.129520.38c3=062b112c89085df4.1370792656.37.1371243733.1371236176.; _pk_ses.129520.38c3=*; __zlcid=%7B%22mID%22%3A%226lcsSDyhu4rSn9%22%2C%22sid%22%3A%22130614.359848.57mMZLbH%22%7D
    User-Agent:Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36
    Query String Parametersview sourceview URL encoded
    controller:AdminInformation
    token:bd877db7bbade7f6c44ef3a439cc5e2c
    Response Headersview source
    Accept-Ranges:bytes
    Age:60
    Connection:close
    Content-Length:1
    Content-Type:text/html; charset=utf-8
    Date:Fri, 14 Jun 2013 21:13:42 GMT
    Server:Varnish
    Via:1.1 varnish
    X-Varnish:2182704337

    Normaly are the 503 error a server host prob, but I have contact they about this, and they can’t find enything that going wrong on the server.
    I have replace the controller, the index file from origine, I run the default theme.
    I even remarkt, that when I do some things, like regenerate pictures from the products, select 1 option to regenerate and tray to import and configurate the cvs file headings and click on the green button, they run even out to a blank white page, no errors to seen..

    Thanks in Advance
    Roger

  5. What is your Prestashop version? If it’s 1.5.3 and later (as it’s written in the article) you need to edit defines.inc.php in config folder ONLY

    /* Debug only */
    define(‘_PS_MODE_DEV_’, false);

    and change it to

    /* Debug only */
    define(‘_PS_MODE_DEV_’, true);

  6. can not found

    /* Debug only */
    @ini_set(‘display_errors’, ‘off’);
    define(‘_PS_DEBUG_SQL_’, false);

    in config.inc.php in config folder

  7. Also don’t forget to set error_reporting(E_ALL); in your config/defines.inc.php

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *