Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Easy way to show php errors for debuggin
  • Posted: 14.09.2007, 19:42
     
    pheski
    rank:
    Professional Professional
    registered:
     February 2005
    Status:
    offline
    last visit:
    09.04.08
    Posts:
    1480
    When debugging PHP or trying to solve problems like a Blank Page, the first thing you will be told is to show PHP errors, and the usual ways you will be told to try are:

    • =>changing php.ini
    • =>adding an htaccess file to your PN root


    These both work well - when you can use them. Many don't have shell access and cannot change their php.ini files, and some will not be able to use htaccess because of other server configurations over which they have no control.


    Fortunately, PHP has many ways to do things.


    Go to config.php and at around lines 77-80 you will see the following:

    Code

    global $pndebug;
    $pndebug['debug']          = 0;
    $pndebug['debug_sql']      = 0;
    $pndebug['pagerendertime'] = 0;



    Add a line and change the first flag from 0 to 1 so it looks like this:


    Code

    global $pndebug;
    $pndebug['debug']          = 1;
    $pndebug['debug_sql']      = 0;
    $pndebug['pagerendertime'] = 0;
    error_reporting(e_all);


    Now you will see error messages on your pages. (There are a few that won't show up, but most will.)


    Make sure you comment out the last line when you are done. Putting // in front of error_reporting will turn it off. This is important because the error messages will confuse the devil out of ordinary users and can give hackers information you don't want them to have about your file structure.


    Hope this tip helps folks. It is a quick and easy way to turn PHP errors on and off while mucking around.


    Peter



    edited by: pheski, Sep 14, 2007 - 09:45 AM

    --
    Peace
    ______________________________________
    The commonest cause of problems is solutions.
  • Posted: 16.09.2007, 20:55
     
    kaffeeringe.de
    rank:
    Professional Professional
    registered:
     September 2002
    Status:
    offline
    last visit:
    19.11.08
    Posts:
    879
    Please put the into the Wiki icon_wink

    --
    best regards from Kiel, sailing city

    Steffen Voss

    Member of the PostNuke Steering Committee
    Read The Zikulan's Blog
  • Posted: 17.09.2007, 07:59
     
    pheski
    rank:
    Professional Professional
    registered:
     February 2005
    Status:
    offline
    last visit:
    09.04.08
    Posts:
    1480
    I went to add it to the Wiki and someone had gotten there before me.

    I'm happy to be able to contribute.

    Peter

    --
    Peace
    ______________________________________
    The commonest cause of problems is solutions.

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula