PHP error_log() Function

The error_log() function sends an error message to a log, to a file, or to a mail account.

Example -

ParameterDescription
messageRequired. Specifies the error message to log
typeOptional. Specifies where the error message should go. Possible values:
  • 0 - Default. Message is sent to PHP's system logger, using the OS' system logging mechanism or a file, depending on what the error_log configuration is set to in php.ini
  • 1 - Message is sent by email to the address in the destination parameter
  • 2 - No longer in use (only available in PHP 3)
  • 3 - Message is appended to the file specified in destination
  • 4 - Message is sent directly to the SAPI logging handler
  • destinationOptional. Specifies the destination of the error message. This value depends on the value of the type parameter
    headersOptional. Only used if the type parameter is set to 1. Specifies additional headers, like From, Cc, and Bcc. Multiple headers should be separated with a CRLF (\r\n)