Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

php - force error reporting on

Options
  • 26-07-2007 9:47am
    #1
    Closed Accounts Posts: 975 ✭✭✭


    I'm developing a solution on shared hosting with error reposting set off in php.ini. I was under the impression that
    error_reporting(E_ALL);
    

    at the top of my php code would force reporting on for the current script. What I'm getting back is partial html, where the script aborts for parsing errors. I can sort it out with judicious use of echo commands but it's a pain.

    I did see this user comment in php manual

    On a shared debugging and production server it is convenient to use
    <?php error_reporting(E_ALL);
    ?>
    for debugging.

    This will not help in case of parsing errors, so make sure you enable at least E_PARSE in your php.ini. Parse errors should not exist in production scripts.


    but it doesn't suggest a solution where you have no access to php.ini.


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    It is a pain... :)

    The problem is that the parse phase takes place before the interpretation, so the error_reporting() directive hasn't yet been read, and so it doesn't make a difference what you put in there. error_reporting() is a runtime directive.

    Seeing as you're talking about php.ini, I'm assuming that it's a Windows box. Which is a pity because if you had a Linux box, you could use the .htaccess file to set the error_reporting directive;
    php_value error_reporting 4
    

    Aside from that, perhaps you could ask the host to enable E_PARSE on the box. As your quote says, Parse errors shouldn't really exist in production scripts, so it shouldn't be a problem turning that on.


  • Closed Accounts Posts: 975 ✭✭✭squibs


    Thanks for the explanation. It makes perfect sense now I think about it. I am on a linux box, so htaccess may be an option.


Advertisement