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

Support Forum

Start ::  PostNuke 0.7 Support ::  Tutorials and Solutions ::  Easy way to show php errors for debuggin

Moderated by: Support Team

Bottom
Easy way to show php errors for debuggin

  • Link to this postingPosted: 14.09.2007, 19:42
    Profile Homepage
    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.
  • Link to this postingPosted: 16.09.2007, 20:55
    Profile Homepage
    kaffeeringe.de
    rank:
    Professional Professional
    registered:
     September 2002
    Status:
    offline
    last visit:
    14.08.08
    Posts:
    855
    Please put the into the Wiki icon_wink

    -----
    best regards from Kiel, sailing city

    Steffen Voss

    Member of the PostNuke Steering Committee
    Follow The Zikulan at Twitter
  • Link to this postingPosted: 17.09.2007, 07:59
    Profile Homepage
    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.

Start ::  PostNuke 0.7 Support ::  Tutorials and Solutions ::  Easy way to show php errors for debuggin

Main Menu

Extensions Database

Documentation

Development

Login





 


 Log in Problems?
 New User? Sign Up!

Donate to Zikula