what is error reporting in php..

Discussion in 'PHP' started by bhuppi890109, Apr 25, 2011.

  1. #1
    friends can you tell me what is error reporting and why we use it and how to use it...explain it
     
    bhuppi890109, Apr 25, 2011 IP
  2. Sepehr

    Sepehr Peon

    Messages:
    568
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    With PHP you can define how he engine reacts to errors. You can define whether to show them or not. You can also define specific procedures to be executed if an error occurs(i.e. logging the error with some additional info if necessary).

    More info here:
    http://php.net/manual/en/book.errorfunc.php
     
    Sepehr, Apr 25, 2011 IP
  3. blakeembrey

    blakeembrey Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If your developing, it is recommended you enable it so you can see any errors that may occur while loading the script/page in PHP. Really useful for optimizing your script. If your on a production server, always keep it disabled since it could expose exploits. In any case, it's usually best to enable the log, so you can still debug the production script if needed.
     
    blakeembrey, Apr 26, 2011 IP
  4. ap2010

    ap2010 Guest

    Messages:
    41
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    error_reporting directive tells PHP what errors it should display/log. Errors are classified by severity, some are just ignorable, some are fatal and cause PHP to halt. error_reporting directive tells php what errors to display/log in case they happen. Normally people change this value so that most of the "ignoreable" errors are suppressed, although, on a development machine, FULL error reporting must be set.

    PS: You must also set display_errors = On to see the errors in browser and/or log_errors = On + error_log = C:\WINDOWS\Temp\phperror.txt to log errors in file.
     
    ap2010, Apr 26, 2011 IP