Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

php - force error reporting on

  • 26-07-2007 08: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, Registered Users 2 Posts: 68,173 ✭✭✭✭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