error_log
Send an error message somewhere
error_log()
function sends an error message to the server error log, file, or remote target.
Send error messages to the web server log and email account:
<?php // If the error is connected to the database, an error message is sent to the server log if ( ! mysqli_connect ( "localhost" , "bad_user" , "bad_password" , "my_db" ) ) { error_log ( "Failed to connect to database!" , 0 ) ; } // If you run out of FOO, send an email to the administrator if ( ! ( $foo = allocate_new_foo ( ) ) ) { error_log ( "Oh no! We are out of FOOs!" , 1 , "admin@example.com" ) ; } ?>
error_log ( message , type , destination , headers ) ;
parameter | describe |
---|---|
message | Required. Specifies the error message to be recorded. |
type |
Optional. Specify where errors should be sent. Possible values:
|
destination | Optional. Specify the target of the error message. This value is determined by the value of the type parameter. |
Headers |
Optional. Specify additional headers such as From, Cc and Bcc. This information type uses the same built-in function of mail(). Only used when message_type is set to 1. CRLF (\r\n) should be used to separate multiple headers. |