English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Basic PHP Tutorial

Advanced PHP Tutorial

PHP & MySQL

PHP Reference Manual

PHP error_log() Function Usage and Examples

PHP Error & Loggings Reference Manual

The error_log() function sends error information to a location

Syntax

bool error_log ( string $message [, int $message_type [, string $destination [, string $extra_headers]]] )

Definition and Usage

It sends the error message to the web server's error log, TCP port, or to a file.

Parameter

Serial NumberParameters and Description
1

message

The error message that should be logged.

2

message_type

It indicates where the error should go. Possible message types may include-

  • 0 - Default. Errors will be sent to the server logging system or file, depending on how the error_log configuration is set in the php.ini file

  • 1 - to the email address set by the parameter destination. The fourth parameter extra_headers is only used in this type.

  • 2 - Send errors via PHP debugging connection. This option is only available in PHP 3 available.

  • 3 - The error is added to the file target string

3

destination

Specify where to send error messages. Its meaning is described above, determined by the message_type parameter.

4

extra_headers

Additional headers. When message_type is set to 1 Use this when. This information type uses the same built-in function as mail().

Return Value

Returns TRUE on success, FALSE on failure.

PHP Error & Loggings Reference Manual