Logging Your Own Error Messages In PHP

logging-error-messages-php When an error is raised, the PHP engine usually logs the error message somewhere. A user can control exactly where the error message is logged by using a few PHP configuration directives:

    • display_errors: This controls the error messages are displayed in the browser. A user can Set to On to display errors, or Off to prevent errors from being displayed. Error messages contain sensitive information which is useful to hackers, so a user should set display_errors to Off on the live Web site.


    • log_errors: This Controls whether error messages are recorded in an error log. Set to On to log errors in an error log, or Off to disable error logging.


  • error_log : This Specifies the full path of the log file to log errors to. The default is usually the system log or the Web server’s error log. In Windows the message is logged in the Event Log).

    display_errors = Off
    ini_set( “display_errors”, “Off” );

Scroll to Top