PHP: error_log - Manual in Deutsh
PHP: error_log - Manual in French
PHP: error_log - Manual in Polish

You Are At PHP: error_log - Manual Area


recent searches:
include functions , variable functions , post functions...




If you are new to PHP or just need to refresh your skills, this is the place to start. This series of tutorials will give you the basic knowledge you will need to create a simple PHP website.

PHP is a reflective programming language originally designed for producing dynamic web pages.[1] PHP is used mainly in server-side scripting, but can be used from a command line interface or in standalone graphical applications. Textual User Interfaces can also be created using ncurses.

PHP Manual
PrevNext

error_log

(PHP 3, PHP 4, PHP 5)

error_log -- Send an error message somewhere

Description

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

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

Parameters

message

The error message that should be logged.

message_type

Says where the error should go. The possible message types are as follows:

Table 1. error_log() log types

0 message is sent to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to. This is the default option.
1 message is sent by email to the address in the destination parameter. This is the only message type where the fourth parameter, extra_headers is used.
2 message is sent through the PHP debugging connection. This option is only available if remote debugging has been enabled. In this case, the destination parameter specifies the host name or IP address and optionally, port number, of the socket receiving the debug information. This option is only available in PHP 3.
3 message is appended to the file destination. A newline is not automatically added to the end of the message string.

destination

The destination. Its meaning depends on the message_type parameter as described above.

extra_headers

The extra headers. It's used when the message_type parameter is set to 1. This message type uses the same internal function as mail() does.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example 1. error_log() examples

<?php
// Send notification through the server log if we can not
// connect to the database.
if (!Ora_Logon($username, $password)) {
    
error_log("Oracle database not available!", 0);
}

// Notify administrator by email if we run out of FOO
if (!($foo = allocate_new_foo())) {
    
error_log("Big trouble, we're all out of FOOs!", 1,
               
"operator@example.com");
}

// other ways of calling error_log():
error_log("You messed up!", 2, "127.0.0.1:7000");
error_log("You messed up!", 2, "loghost");
error_log("You messed up!", 3, "/var/tmp/my-errors.log");
?>

Numizmatyka
Agencja Reklamowa Katowice
analizy
banki kredyty
salon

Another Useful functions:


zend-api.zend-stream-ferror | zend-api.zend-get-error-exception | zend-api.zend-exception-error | zend-api.zend-error | zend-api.tsrm-error | zend-api.tsrm-error-set | security.errors | ref.errorfunc | phpdevel-errors | migration52.errorrep | migration52.error-messages | migration4.error-reporting | migration.errors | migrating5.errorrep | language.operators.errorcontrol | internals.pdo.error-handling | function.yaz-error | function.xslt-set-error-handler | function.xslt-error | function.xml-get-error-code | function.xml-error-string | function.vpopmail-error | function.user-error | function.use-soap-error-handler | function.udm-error | function.trigger-error | function.tidy-get-error-buffer | function.tidy-error-count | function.sybase-min-error-severity | function.sqlite-last-error | function.sqlite-error-string | function.socket-strerror | function.socket-last-error | function.socket-clear-error | function.set-error-handler | function.session-pgsql-get-error | function.session-pgsql-add-error | function.sesam-errormsg | function.samconnection-error | function.restore-error-handler | function.radius-strerror | function.qdom-error | function.preg-last-error | function.posix-strerror | function.posix-get-last-error | function.pg-set-error-verbosity | function.pg-result-error | function.pg-result-error-field | function.pg-last-error | function.pdostatement-errorinfo | function.pdostatement-errorcode | function.pdo-errorinfo | function.pdo-errorcode | function.ora-errorcode | function.ora-error | function.openssl-error-string | function.odbc-errormsg | function.odbc-error | function.ocierror | function.oci-error | function.mysqli-stmt-error | function.mysqli-error | function.mysqli-connect-error | function.mysql-error | function.mssql-min-error-severity | function.msql-error | function.maxdb-stmt-error | function.maxdb-error | function.maxdb-connect-error | function.m-connectionerror | function.libxml-use-internal-errors | function.libxml-get-last-error | function.libxml-get-errors | function.libxml-clear-errors | function.ldap-error | function.ircg-fetch-error-msg | function.ingres-error | function.imap-last-error | function.imap-errors | function.imagick-iserror | function.imagick-error | function.ifx-errormsg | function.ifx-error | function.hwapi-error-reason | function.hwapi-error-count | function.hw-errormsg | function.hw-error | function.harudoc-reseterror | function.gnupg-seterrormode | function.gnupg-geterror | function.fdf-error | function.fbsql-error | function.error-reporting | function.error-log | function.error-get-last | function.enchant-dict-get-error | function.enchant-broker-get-error | function.dbx-error | function.db2-stmt-errormsg | function.db2-stmt-error | function.db2-conn-errormsg | function.db2-conn-error | function.curl-error | function.bzerror | features.file-upload.errors | |


PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. If you are new to PHP and want to get some idea of how it works, try the introductory tutorial. After that, check out the online manual, and the example archive sites and some of the other resources available in the links section.