php-doc-en/reference/errorfunc/ini.xml

511 lines
17 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="errorfunc.configuration" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.runtime;
&extension.runtime;
<para>
<table>
<title>Errors and Logging Configuration Options</title>
<tgroup cols="4">
<thead>
<row>
<entry>&Name;</entry>
<entry>&Default;</entry>
<entry>&Changeable;</entry>
<entry>&Changelog;</entry>
</row>
</thead>
<tbody>
<row>
<entry><link linkend="ini.error-reporting">error_reporting</link></entry>
<entry>NULL</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.display-errors">display_errors</link></entry>
<entry>"1"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.display-startup-errors">display_startup_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.log-errors">log_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.log-errors-max-len">log_errors_max_len</link></entry>
<entry>"1024"</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since PHP 4.3.0.</entry>
</row>
<row>
<entry><link linkend="ini.ignore-repeated-errors">ignore_repeated_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since PHP 4.3.0.</entry>
</row>
<row>
<entry><link linkend="ini.ignore-repeated-source">ignore_repeated_source</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since PHP 4.3.0.</entry>
</row>
<row>
<entry><link linkend="ini.report-memleaks">report_memleaks</link></entry>
<entry>"1"</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since PHP 4.3.0.</entry>
</row>
<row>
<entry><link linkend="ini.track-errors">track_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.html-errors">html_errors</link></entry>
<entry>"1"</entry>
<entry>PHP_INI_ALL</entry>
<entry>PHP_INI_SYSTEM in PHP &lt;= 4.2.3.</entry>
</row>
<row>
<entry><link linkend="ini.xmlrpc-errors">xmlrpc_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_SYSTEM</entry>
<entry>Available since PHP 4.1.0.</entry>
</row>
<row>
<entry><link linkend="ini.xmlrpc-error-number">xmlrpc_error_number</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since PHP 4.1.0.</entry>
</row>
<row>
<entry><link linkend="ini.docref-root">docref_root</link></entry>
<entry>""</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since PHP 4.3.0.</entry>
</row>
<row>
<entry><link linkend="ini.docref-ext">docref_ext</link></entry>
<entry>""</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available since PHP 4.3.2.</entry>
</row>
<row>
<entry><link linkend="ini.error-prepend-string">error_prepend_string</link></entry>
<entry>NULL</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.error-append-string">error_append_string</link></entry>
<entry>NULL</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.error-log">error_log</link></entry>
<entry>NULL</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
&ini.php.constants;
</para>
&ini.descriptions.title;
<para>
<variablelist>
<varlistentry xml:id="ini.error-reporting">
<term>
<parameter>error_reporting</parameter>
<type>integer</type>
</term>
<listitem>
<para>
Set the error reporting level. The parameter is either an integer
representing a bit field, or named constants. The error_reporting
levels and constants are described in
<link linkend="errorfunc.constants">Predefined Constants</link>,
and in &php.ini;. To set at runtime, use the
<function>error_reporting</function> function. See also the
<link linkend="ini.display-errors">display_errors</link> directive.
</para>
<para>
PHP 5.3 or later, the default value
is <constant>E_ALL</constant> &amp;
~<constant>E_NOTICE</constant> &amp;
~<constant>E_STRICT</constant> &amp;
~<constant>E_DEPRECATED</constant>. This setting does not
show <constant>E_NOTICE</constant>, <constant>E_STRICT</constant>
and <constant>E_DEPRECATED</constant> level errors. You may want
to show them during development.
Prior to PHP 5.3.0, the default value
is <constant>E_ALL</constant> &amp;
~<constant>E_NOTICE</constant> &amp;
~<constant>E_STRICT</constant>.
In PHP 4 the default value is <constant>E_ALL</constant>
&amp; ~<constant>E_NOTICE</constant>.
</para>
<note>
<para>Enabling <constant>E_NOTICE</constant> during development has
some benefits. For debugging purposes: NOTICE messages will warn you
about possible bugs in your code. For example, use of unassigned values
is warned. It is extremely useful to find typos and
to save time for debugging. NOTICE messages will warn you about bad style.
For example, <literal>$arr[item]</literal> is better to be written as
<literal>$arr['item']</literal> since PHP tries to treat
<literal>"item"</literal> as constant. If it is not a constant, PHP assumes
it is a string index for the array.
</para>
</note>
<note>
<para>
In PHP 5 a new error level <constant>E_STRICT</constant> is available.
Prior to PHP 5.4.0 <constant>E_STRICT</constant> was not included within
<constant>E_ALL</constant>, so you would have to explicitly enable this kind of
error level in PHP &lt; 5.4.0. Enabling <constant>E_STRICT</constant> during development
has some benefits. STRICT messages provide suggestions that can help
ensure the best interoperability and forward compatibility of your code.
These messages may include things such as calling non-static methods
statically, defining properties in a compatible class definition while
defined in a used trait, and prior to PHP 5.3 some deprecated features
would issue <constant>E_STRICT</constant> errors such as assigning
objects by reference upon instantiation.
</para>
</note>
<note>
<title>PHP Constants outside of PHP</title>
<para>
Using PHP Constants outside of PHP, like in <filename>httpd.conf</filename>,
will have no useful meaning so in such cases the <type>integer</type> values
are required. And since error levels will be added over time, the maximum
value (for <constant>E_ALL</constant>) will likely change. So in place of
<constant>E_ALL</constant> consider using a larger value to cover all bit
fields from now and well into the future, a numeric value like
<literal>2147483647</literal> (includes all errors, not just
<constant>E_ALL</constant>).
</para>
</note>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.display-errors">
<term>
<parameter>display_errors</parameter>
<type>string</type>
</term>
<listitem>
<para>
This determines whether errors should be printed to the screen
as part of the output or if they should be hidden from the user.
</para>
<para>
Value <literal>"stderr"</literal> sends the errors to <literal>stderr</literal>
instead of <literal>stdout</literal>. The value is available as of PHP
5.2.4. In earlier versions, this directive was of type <type>boolean</type>.
</para>
<note>
<para>
This is a feature to support your development and should never be used
on production systems (e.g. systems connected to the internet).
</para>
</note>
<note>
<para>
Although display_errors may be set at runtime (with <function>ini_set</function>),
it won't have any affect if the script has fatal errors.
This is because the desired runtime action does not get executed.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.display-startup-errors">
<term>
<parameter>display_startup_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Even when display_errors is on, errors that occur during PHP's startup
sequence are not displayed. It's strongly recommended to keep
display_startup_errors off, except for debugging.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.log-errors">
<term>
<parameter>log_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Tells whether script error messages should be logged to the
server's error log or <link linkend="ini.error-log">error_log</link>.
This option is thus server-specific.
</para>
<note>
<para>
You're strongly advised to use error logging in place of
error displaying on production web sites.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.log-errors-max-len">
<term>
<parameter>log_errors_max_len</parameter>
<type>integer</type>
</term>
<listitem>
<para>
Set the maximum length of log_errors in bytes. In
<link linkend="ini.error-log">error_log</link> information about
the source is added. The default is 1024 and 0 allows to not apply
any maximum length at all.
This length is applied to logged errors, displayed errors and also to
<varname>$php_errormsg</varname>.
</para>
&ini.shorthandbytes;
</listitem>
</varlistentry>
<varlistentry xml:id="ini.ignore-repeated-errors">
<term>
<parameter>ignore_repeated_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Do not log repeated messages. Repeated errors must occur in the same
file on the same line unless
<link linkend="ini.ignore-repeated-source">ignore_repeated_source</link>
is set true.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.ignore-repeated-source">
<term>
<parameter>ignore_repeated_source</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Ignore source of message when ignoring repeated messages. When this setting
is On you will not log errors with repeated messages from different files or
sourcelines.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.report-memleaks">
<term>
<parameter>report_memleaks</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
If this parameter is set to On (the default), this parameter will show a
report of memory leaks detected by the Zend memory manager. This report
will be send to stderr on Posix platforms. On Windows, it will be send
to the debugger using OutputDebugString(), and can be viewed with tools
like <link xlink:href="&url.dbgview;">DbgView</link>.
This parameter only has effect in a debug build, and if
error_reporting includes <constant>E_WARNING</constant> in the allowed
list.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.track-errors">
<term>
<parameter>track_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
If enabled, the last error message will always be present in the
variable <varname>$php_errormsg</varname>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.html-errors">
<term>
<parameter>html_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Turn off HTML tags in error messages. The new format for HTML errors
produces clickable messages that direct the user to a page describing
the error or function in causing the error. These references are
affected by
<link linkend="ini.docref-root">docref_root</link> and
<link linkend="ini.docref-ext">docref_ext</link>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.xmlrpc-errors">
<term>
<parameter>xmlrpc_errors</parameter>
<type>boolean</type>
</term>
<listitem>
<para>
Turns off normal error reporting and formats errors as XML-RPC error message.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.xmlrpc-error-number">
<term>
<parameter>xmlrpc_error_number</parameter>
<type>integer</type>
</term>
<listitem>
<para>
Used as the value of the XML-RPC faultCode element.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.docref-root">
<term>
<parameter>docref_root</parameter>
<type>string</type>
</term>
<listitem>
<para>
The new error format contains a reference to a page describing the error or
function causing the error. In case of manual pages you can download the
manual in your language and set this ini directive to the URL of your local
copy. If your local copy of the manual can be reached by <literal>"/manual/"</literal>
you can simply use <userinput>docref_root=/manual/</userinput>. Additional you have
to set docref_ext to match the fileextensions of your copy
<userinput>docref_ext=.html</userinput>. It is possible to use external
references. For example you can use
<userinput>docref_root=http://manual/en/</userinput> or
<userinput>docref_root="http://landonize.it/?how=url&amp;theme=classic&amp;filter=Landon
&amp;url=http%3A%2F%2Fwww.php.net%2F"</userinput>
</para>
<para>
Most of the time you want the docref_root value to end with a slash <literal>"/"</literal>.
But see the second example above which does not have nor need it.
</para>
<note>
<para>
This is a feature to support your development since it makes it easy to
lookup a function description. However it should never be used on
production systems (e.g. systems connected to the internet).
</para>
</note>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.docref-ext">
<term>
<parameter>docref_ext</parameter>
<type>string</type>
</term>
<listitem>
<para>
See <link linkend="ini.docref-root">docref_root</link>.
</para>
<note>
<para>
The value of docref_ext must begin with a dot <literal>"."</literal>.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.error-prepend-string">
<term>
<parameter>error_prepend_string</parameter>
<type>string</type>
</term>
<listitem>
<para>
String to output before an error message.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.error-append-string">
<term>
<parameter>error_append_string</parameter>
<type>string</type>
</term>
<listitem>
<para>
String to output after an error message.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.error-log">
<term>
<parameter>error_log</parameter>
<type>string</type>
</term>
<listitem>
<para>
Name of the file where script errors should be logged. The file should
be writable by the web server's user. If the
special value <literal>syslog</literal> is used, the errors
are sent to the system logger instead. On Unix, this means
syslog(3) and on Windows NT it means the event log. The
system logger is not supported on Windows 95. See also:
<function>syslog</function>.
If this directive is not set, errors are sent to the SAPI error logger.
For example, it is an error log in Apache or <literal>stderr</literal>
in CLI.
See also <function>error_log</function>.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</section>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->