Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 543

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>error_log</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Error Handling and Logging Functions"
HREF="ref.errorfunc.html"><LINK
REL="PREVIOUS"
TITLE="debug_backtrace"
HREF="function.debug-backtrace.html"><LINK
REL="NEXT"
TITLE="error_reporting"
HREF="function.error-reporting.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.debug-backtrace.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.error-reporting.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.error-log"
></A
>error_log</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN22892"
></A
><P
>    (PHP 3, PHP 4 )</P
>error_log&nbsp;--&nbsp;send an error message somewhere</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN22895"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>error_log</B
> ( string message [, int message_type [, string destination [, string extra_headers]]])<BR
></BR
><P
>&#13;     Sends an error message to the web server's error log, a
     <SPAN
CLASS="acronym"
>TCP</SPAN
> port or to a file.  The first parameter,
     <TT
CLASS="parameter"
><I
>message</I
></TT
>, is the error message that should
     be logged.  The second parameter,
     <TT
CLASS="parameter"
><I
>message_type</I
></TT
> says where the message should
     go:
     <DIV
CLASS="table"
><A
NAME="AEN22916"
></A
><P
><B
>Table 1. <B
CLASS="function"
>error_log()</B
> log types</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><TBODY
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>0</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;      <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent to PHP's system
      logger, using the Operating System's system logging
      mechanism or a file, depending on what the <A
HREF="ref.errorfunc.html#ini.error-log"
>error_log</A
> configuration
      directive is set to.
     </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>1</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;      <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent by email to the
      address in the <TT
CLASS="parameter"
><I
>destination</I
></TT
> parameter.
      This is the only message type where the fourth parameter,
      <TT
CLASS="parameter"
><I
>extra_headers</I
></TT
> is used.  This message
      type uses the same internal function as
      <A
HREF="function.mail.html"
><B
CLASS="function"
>mail()</B
></A
> does.
     </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>2</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;      <TT
CLASS="parameter"
><I
>message</I
></TT
> is sent through the PHP debugging
      connection.  This option is only available if <A
HREF="install.configure.html#install.configure.enable-debugger"
>remote debugging has
      been enabled</A
>.  In this case, the
      <TT
CLASS="parameter"
><I
>destination</I
></TT
> parameter specifies the host
      name or IP address and optionally, port number, of the socket
      receiving the debug information.
     </TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>3</TD
><TD
ALIGN="LEFT"
VALIGN="MIDDLE"
>&#13;      <TT
CLASS="parameter"
><I
>message</I
></TT
> is appended to the file
      <TT
CLASS="parameter"
><I
>destination</I
></TT
>.
     </TD
></TR
></TBODY
></TABLE
></DIV
>
    </P
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>Warning</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>&#13;      Remote debugging via TCP/IP is a PHP 3 feature that is <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>not</I
></SPAN
>
      available in PHP 4.
     </P
></TD
></TR
></TABLE
></DIV
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN22948"
></A
><P
><B
>Example 1. <B
CLASS="function"
>error_log()</B
> examples</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="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@mydomain.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");</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.debug-backtrace.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.error-reporting.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>debug_backtrace</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.errorfunc.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>error_reporting</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>