How to Debug My PHP Code

From ReduxWiki

(Redirected from How to Debug my PHP Code)
Jump to: navigation, search

As per our Community Forums:

One thing I've found helpful is to turn on PHP's higher level error checking. The following snippet is placed at the top of problematic pages while debugging.

if(TRUE) { // TRUE for debug only
    ini_set("display_errors", "on"); //use off if you don't want users will see them
    error_reporting(E_ALL);

    $error_reporting = '<span style="color:red">Error display and logging on</span>  ';
} //end test

You may merely echo $error_reporting anywhere on the page.

Image:Applications-office.png It's generally good to do so after the <header> and <body> tags.


Image:Tip.png Back to How To Documents
Personal tools
Getting Started