1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-24 07:42:10 +01:00
Files
archived-doc-en/reference/errorfunc/ini.xml
George Peter Banyard 65716f4761 Add initial version of the PHP 8.2 migration guide (#1799)
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>
2022-09-26 10:40:14 +01:00

599 lines
19 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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>"1"</entry>
<entry>PHP_INI_ALL</entry>
<entry>
Prior to PHP 8.0.0, the default value was <literal>"0"</literal>.
</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></entry>
</row>
<row>
<entry><link linkend="ini.ignore-repeated-errors">ignore_repeated_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.ignore-repeated-source">ignore_repeated_source</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.report-memleaks">report_memleaks</link></entry>
<entry>"1"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.track-errors">track_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry>Deprecated as of PHP 7.2.0, removed as of PHP 8.0.0.</entry>
</row>
<row>
<entry><link linkend="ini.html-errors">html_errors</link></entry>
<entry>"1"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.xmlrpc-errors">xmlrpc_errors</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_SYSTEM</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.xmlrpc-error-number">xmlrpc_error_number</link></entry>
<entry>"0"</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.docref-root">docref_root</link></entry>
<entry>""</entry>
<entry>PHP_INI_ALL</entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.docref-ext">docref_ext</link></entry>
<entry>""</entry>
<entry>PHP_INI_ALL</entry>
<entry></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>
<row>
<entry><link linkend="ini.error-log-mode">error_log_mode</link></entry>
<entry>0o644</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available as of PHP 8.2.0</entry>
</row>
<row>
<entry><link linkend="ini.syslog.facility">syslog.facility</link></entry>
<entry>"LOG_USER"</entry>
<entry>PHP_INI_SYSTEM</entry>
<entry>Available as of PHP 7.3.0.</entry>
</row>
<row>
<entry><link linkend="ini.syslog.filter">syslog.filter</link></entry>
<entry>"no-ctrl"</entry>
<entry>PHP_INI_ALL</entry>
<entry>Available as of PHP 7.3.0.</entry>
</row>
<row>
<entry><link linkend="ini.syslog.ident">syslog.ident</link></entry>
<entry>"php"</entry>
<entry>PHP_INI_SYSTEM</entry>
<entry>Available as of PHP 7.3.0.</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>int</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>
The default value is <constant>E_ALL</constant>.
</para>
<para>
Prior to PHP 8.0.0, the default value was:
<userinput><constant>E_ALL</constant> &amp;
~<constant>E_NOTICE</constant> &amp;
~<constant>E_STRICT</constant> &amp;
~<constant>E_DEPRECATED</constant></userinput>.
This means diagnostics of level <constant>E_NOTICE</constant>,
<constant>E_STRICT</constant> and <constant>E_DEPRECATED</constant>
were not shown.
</para>
<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>int</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>.
</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 effect 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>bool</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>bool</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>int</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>, but not to explicitly called functions
such as <function>error_log</function>.
</para>
&ini.shorthandbytes;
</listitem>
</varlistentry>
<varlistentry xml:id="ini.ignore-repeated-errors">
<term>
<parameter>ignore_repeated_errors</parameter>
<type>bool</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>bool</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>bool</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 sent to stderr on Posix platforms. On Windows, it will be sent
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>bool</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>bool</type>
</term>
<listitem>
<para>
If enabled, error messages will include HTML tags. The 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>
<para>
If disabled, error message will be solely plain text.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.xmlrpc-errors">
<term>
<parameter>xmlrpc_errors</parameter>
<type>bool</type>
</term>
<listitem>
<para>
If enabled, 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>int</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.
Only used when the error message is displayed on screen. The main purpose
is to be able to prepend additional HTML markup to the 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.
Only used when the error message is displayed on screen. The main purpose
is to be able to append additional HTML markup to the 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 it means the event log. 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>
<varlistentry xml:id="ini.error-log-mode">
<term>
<parameter>error_log_mode</parameter>
<type>int</type>
</term>
<listitem>
<para>
File mode for the file described set in
<link linkend="ini.error-log">error_log</link>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.syslog.facility">
<term>
<parameter>syslog.facility</parameter>
<type>string</type>
</term>
<listitem>
<para>
Specifies what type of program is logging the message.
Only effective if <link linkend="ini.error-log">error_log</link> is set to "syslog".
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.syslog.filter">
<term>
<parameter>syslog.filter</parameter>
<type>string</type>
</term>
<listitem>
<para>
Specifies the filter type to filter the logged messages. Allowed
characters are passed unmodified; all others are written in their
hexadecimal representation prefixed with <literal>\x</literal>.
<itemizedlist>
<listitem>
<simpara><literal>all</literal> the logged string will be split
at newline characters, and all characters are passed unaltered
</simpara>
</listitem>
<listitem>
<simpara><literal>ascii</literal> the logged string will be split
at newline characters, and any non-printable 7-bit ASCII characters will be escaped
</simpara>
</listitem>
<listitem>
<simpara><literal>no-ctrl</literal> the logged string will be split
at newline characters, and any non-printable characters will be escaped
</simpara>
</listitem>
<listitem>
<simpara><literal>raw</literal> all characters are passed to the system
logger unaltered, without splitting at newlines (identical to PHP before 7.3)
</simpara>
</listitem>
</itemizedlist>
This setting will affect logging via <link linkend="ini.error-log">error_log</link> set to "syslog" and calls to <function>syslog</function>.
</para>
<note>
<para>
The <literal>raw</literal> filter type is available as of PHP 7.3.8 and PHP 7.4.0.
</para>
</note>
<simpara>
This directive is not supported on Windows.
</simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.syslog.ident">
<term>
<parameter>syslog.ident</parameter>
<type>string</type>
</term>
<listitem>
<para>
Specifies the ident string which is prepended to every message.
Only effective if <link linkend="ini.error-log">error_log</link> is set to "syslog".
</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
-->