Better way to debug php script Enable error log for individual folder php script.

Better way to debug php script Enable error log for individual folder php script.


how to enable in php.ini

You have to set on php.ini file directive as follow,string "error_log" on right side is the file name u want for log,

Check the value of error_reporting.

For example i have error_reporting value is 24567 by runing below function you will know that which type of error is enable in PHP for error_log.

Following below function show the enable error just replace by $error_number = your number.

<?php
    $error_number = 24567;
    $error_description = array( );
    $error_codes = array(
        E_ERROR              => "E_ERROR",
        E_WARNING            => "E_WARNING",
        E_PARSE              => "E_PARSE",
        E_NOTICE             => "E_NOTICE",
        E_CORE_ERROR         => "E_CORE_ERROR",
        E_CORE_WARNING       => "E_CORE_WARNING",
        E_COMPILE_ERROR      => "E_COMPILE_ERROR",
        E_COMPILE_WARNING    => "E_COMPILE_WARNING",
        E_USER_ERROR         => "E_USER_ERROR",
        E_USER_WARNING       => "E_USER_WARNING",
        E_USER_NOTICE        => "E_USER_NOTICE",
        E_STRICT             => "E_STRICT",
        E_RECOVERABLE_ERROR  => "E_RECOVERABLE_ERROR",
        E_DEPRECATED         => "E_DEPRECATED",
        E_USER_DEPRECATED    => "E_USER_DEPRECATED",
        E_ALL                => "E_ALL"
    );
    foreach( $error_codes as $number => $description )
    {
        if ( ( $number & $error_number ) == $number )
        {
            $error_description[ ] = $description;
        }
    }
    echo "
";
    echo sprintf(
        "error number %d corresponds to:\n%s",
        $error_number,
        implode( " | ", $error_description )
    );
    echo "
"; ?>

No comments:

Powered by Blogger.