SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Weird yet Funny IpowerWeb bug!

    Hi all,

    On a live site, I've added
    Code:
    ini_set('display_errors',0);
    at the top of my code, to hide any unexpected errors from the end user.

    But this makes the things worse, as whenever there's a fatal error, the output will be an Internal server error!

    eg:
    PHP Code:
    <?php
    ini_set
    ('display_errors',1);
    crash_the_bogus_ipower(); # ;)
    ?>
    output: Fatal error: Call to undefined function crash_the_bogus_ipower() .....

    PHP Code:
    <?php
    ini_set
    ('display_errors',0);
    crash_the_bogus_ipower(); # ;)
    ?>
    0
    Internal Server Error

    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

    More information about this error may be available in the server error log.
    Any clues? I've contacted the support team but they are still 'beating around the bush'

    @Mod: Not sure if this is the right forum. Please move it, if it's not.

  2. #2
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,880
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    Try this:

    PHP Code:
    <?php 
      ini_set
    ('display_errors'true); 
      
    error_reporting(0);           # http://php.net/manual/en/function.error-reporting.php

      
    crash_the_bogus_ipower(); # ;) 
    ?>
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  3. #3
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply.

    I originally had that in my code. I've removed it while posting here, to get the focus on the root cause.

    - the answer : No effect.

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,880
    Mentioned
    74 Post(s)
    Tagged
    6 Thread(s)
    From the Php Manual:

    Note:

    Although display_errors may be set at runtime (with ini_set()), it won't have any affect if the script has fatal errors. This is because the desired runtime action does not get executed.
    The way I handle errors is:
    PHP Code:

      
    # top level calling program
      
    define('LOCALHOST''localhost' === $_SERVER['SERVER_NAME']);
      
    error_reportingLOCALHOST ? -);
      
    ini_set'display_errors'LOCALHOST ) ; 
    This catches all errors during development and hopefully none appear on a live site;
    Your forced error during development will be detected and should be eliminated.
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Wolfshade on earning Member of the Month for August 2014

  5. #5
    SitePoint Member
    Join Date
    Mar 2011
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your forced error during development will be detected and should be eliminated.
    Initially, I face this issue when I inadvertently set a wrong entry in the DB (of a forum), which resulted in a fatal error inside a loop that generates an xml file (Fatal error : call to function appendChild() from a non object)

    Narrowing down, I realised that, this happens only when there's ini_set('display_errors',0); and a fatal error.

  6. #6
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hi ra00f,

    Quote Originally Posted by ra00f View Post
    Initially, I face this issue when I inadvertently set a wrong entry in the DB (of a forum), which resulted in a fatal error inside a loop that generates an xml file (Fatal error : call to function appendChild() from a non object)

    Narrowing down, I realised that, this happens only when there's ini_set('display_errors',0); and a fatal error.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •