mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00

See https://github.com/phpdocbrbridge/bridge/blob/master/src/revbumper.php for automatic tool for translations. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@342988 c90b9560-bf6c-de11-be94-00142212c4b1
528 lines
17 KiB
XML
528 lines
17 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<section xml:id="apcu.configuration" xmlns="http://docbook.org/ns/docbook">
|
|
&reftitle.runtime;
|
|
&extension.runtime;
|
|
<para>
|
|
Although the default APCu settings are fine for many installations, serious
|
|
users should consider tuning the following parameters.
|
|
</para>
|
|
<para>
|
|
There is one decision to be made configuring APCu.
|
|
How much memory is going to be allocated to APCu.
|
|
The ini directive that controls this is <literal>apc.shm_size</literal>
|
|
Read the sections on this carefully below.
|
|
</para>
|
|
<para>
|
|
Once the server is running, the <literal>apc.php</literal> script that
|
|
is bundled with the extension should be copied somewhere into the docroot and
|
|
viewed with a browser as it provides a detailed analysis of the internal
|
|
workings of APCu. If GD is enabled in PHP, it will even display some
|
|
interesting graphs. If APCu is working, the <literal>Cache full count
|
|
</literal> number (on the left) will display the number of times the cache
|
|
has reached maximum capacity and has had to forcefully clean any entries that
|
|
haven't been accessed in the last <literal>apc.ttl</literal> seconds. This
|
|
number is minimized in a well-configured cache. If the cache is constantly
|
|
being filled, and thusly forcefully freed, the resulting churning will have
|
|
disparaging effects on script performance. The easiest way to minimize this
|
|
number is to allocate more memory for APCu.
|
|
</para>
|
|
<para>
|
|
When APCu is compiled with mmap support (Memory Mapping), it will use only one
|
|
memory segment, unlike when APCu is built with SHM (SysV Shared Memory) support
|
|
that uses multiple memory segments. MMAP does not have a maximum limit like SHM
|
|
does in <literal>/proc/sys/kernel/shmmax</literal>. In general MMAP support is
|
|
recommeded because it will reclaim the memory faster when the webserver is
|
|
restarted and all in all reduces memory allocation impact at startup.
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>APCu 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.apcu.enabled">apc.enabled</link></entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.shm-segments">apc.shm_segments</link></entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.shm-size">apc.shm_size</link></entry>
|
|
<entry>"32M"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.entries-hint">apc.entries_hint</link></entry>
|
|
<entry>"4096"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.ttl">apc.ttl</link></entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.gc-ttl">apc.gc_ttl</link></entry>
|
|
<entry>"3600"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.mmap-file-mask">apc.mmap_file_mask</link></entry>
|
|
<entry>NULL</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.slam-defense">apc.slam_defense</link></entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.enable-cli">apc.enable_cli</link></entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.use-request-time">apc.use_request_time</link></entry>
|
|
<entry>"1"</entry>
|
|
<entry>PHP_INI_ALL</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.serializer">apc.serializer</link></entry>
|
|
<entry>"default"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.rfc1867">apc.rfc1867</link></entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.rfc1867-prefix">apc.rfc1867_prefix</link></entry>
|
|
<entry>"upload_"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.rfc1867-name">apc.rfc1867_name</link></entry>
|
|
<entry>"APC_UPLOAD_PROGRESS"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.rfc1867-freq">apc.rfc1867_freq</link></entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.rfc1867-ttl">apc.rfc1867_ttl</link></entry>
|
|
<entry>"3600"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.coredump-unmap">apc.coredump_unmap</link></entry>
|
|
<entry>"0"</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
<row>
|
|
<entry><link linkend="ini.apcu.preload-path">apc.preload_path</link></entry>
|
|
<entry>NULL</entry>
|
|
<entry>PHP_INI_SYSTEM</entry>
|
|
<entry></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
&ini.php.constants;
|
|
</para>
|
|
|
|
&ini.descriptions.title;
|
|
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry xml:id="ini.apcu.enabled">
|
|
<term>
|
|
<parameter>apc.enabled</parameter>
|
|
<type>boolean</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<literal>apc.enabled</literal> can be set to 0 to disable APC. This is
|
|
primarily useful when APC is statically compiled
|
|
into PHP, since there is no other way to disable
|
|
it (when compiled as a DSO, the <literal>extension</literal>
|
|
line in <literal>php.ini</literal> can just be commented-out).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.shm-segments">
|
|
<term>
|
|
<parameter>apc.shm_segments</parameter>
|
|
<type>integer</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
The number of shared memory segments to allocate
|
|
for the compiler cache. If APC is running out of
|
|
shared memory but <literal>apc.shm_size</literal>
|
|
is set as high as the system allows, raising
|
|
this value might prevent APC from exhausting its memory.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.shm-size">
|
|
<term>
|
|
<parameter>apc.shm_size</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
The size of each shared memory segment given by a shorthand notation as
|
|
described in <link linkend="faq.using.shorthandbytes">this FAQ</link>.
|
|
By default, some systems (including most BSD
|
|
variants) have very low limits on the size of a
|
|
shared memory segment.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.entries-hint">
|
|
<term>
|
|
<parameter>apc.entries_hint</parameter>
|
|
<type>integer</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
A "hint" about the number of distinct variables that might be stored.
|
|
Set to zero or omit if not sure.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.ttl">
|
|
<term>
|
|
<parameter>apc.ttl</parameter>
|
|
<type>integer</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
The number of seconds a cache entry is allowed to
|
|
idle in a slot in case this cache entry slot is
|
|
needed by another entry. Leaving this at zero
|
|
means that APC's cache could potentially fill up
|
|
with stale entries while newer entries won't be
|
|
cached. In the event of a cache running out of
|
|
available memory, the cache will be completely
|
|
expunged if ttl is equal to 0. Otherwise, if the
|
|
ttl is greater than 0, APC will attempt to remove
|
|
expired entries.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.gc-ttl">
|
|
<term>
|
|
<parameter>apc.gc_ttl</parameter>
|
|
<type>integer</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
The number of seconds that a cache entry may
|
|
remain on the garbage-collection list. This value
|
|
provides a fail-safe in the event that a server
|
|
process dies while executing a cached source file;
|
|
if that source file is modified, the memory
|
|
allocated for the old version will not be
|
|
reclaimed until this TTL reached. Set to zero to
|
|
disable this feature.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.mmap-file-mask">
|
|
<term>
|
|
<parameter>apc.mmap_file_mask</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
If compiled with MMAP support by using <literal>--enable-mmap</literal>
|
|
this is the mktemp-style file_mask to pass to the
|
|
mmap module for determining whether your mmap'ed memory
|
|
region is going to be file-backed or shared memory
|
|
backed. For straight file-backed mmap, set it to
|
|
something like <literal>/tmp/apc.XXXXXX</literal>
|
|
(exactly 6 <literal>X</literal>s).
|
|
To use POSIX-style shm_open/mmap put a <literal>.shm</literal>
|
|
somewhere in your mask. e.g. <literal>/apc.shm.XXXXXX</literal>
|
|
You can also set it to <literal>/dev/zero</literal> to use your
|
|
kernel's <literal>/dev/zero</literal> interface to anonymous mmap'ed
|
|
memory. Leaving it undefined will force an anonymous mmap.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.slam-defense">
|
|
<term>
|
|
<parameter>apc.slam_defense</parameter>
|
|
<type>integer</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
On very busy servers whenever you start the server or
|
|
modify files you can create a race of many processes
|
|
all trying to cache the same file at the same time.
|
|
This option sets the percentage of processes that will
|
|
skip trying to cache an uncached file. Or think of it
|
|
as the probability of a single process to skip caching.
|
|
For example, setting <literal>apc.slam_defense</literal>
|
|
to <literal>75</literal> would mean that there is
|
|
a 75% chance that the process will not cache an uncached
|
|
file. So, the higher the setting the greater the defense
|
|
against cache slams. Setting this to <literal>0</literal>
|
|
disables this feature.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.enable-cli">
|
|
<term>
|
|
<parameter>apc.enable_cli</parameter>
|
|
<type>integer</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Mostly for testing and debugging. Setting this enables APC
|
|
for the CLI version of PHP. Under normal circumstances, it is
|
|
not ideal to create, populate and destroy the APC cache on every
|
|
CLI request, but for various test scenarios it is useful to be
|
|
able to enable APC for the CLI version of PHP easily.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.serializer">
|
|
<term>
|
|
<parameter>apc.serializer</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Used to configure APC to use a third party serializer.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="ini.apcu.rfc1867">
|
|
<term>
|
|
<parameter>apc.rfc1867</parameter>
|
|
<type>boolean</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
RFC1867 File Upload Progress hook handler is only available if APC
|
|
was compiled against PHP 5.2.0 or later. When enabled, any file uploads
|
|
which includes a field called <literal>APC_UPLOAD_PROGRESS</literal>
|
|
before the file field in an upload form will cause APC to automatically
|
|
create an upload_<emphasis>key</emphasis> user cache entry where
|
|
<emphasis>key</emphasis> is the value of the
|
|
<literal>APC_UPLOAD_PROGRESS</literal> form entry.
|
|
</para>
|
|
<para>
|
|
Note that the hidden field specified by
|
|
<literal>APC_UPLOAD_PROGRESS</literal> must come before the file field,
|
|
otherwise the upload progress will not work correctly.
|
|
</para>
|
|
<para>
|
|
Note that the file upload tracking is not threadsafe at this point, so
|
|
new uploads that happen while a previous one is still going will disable
|
|
the tracking for the previous.
|
|
</para>
|
|
<para>
|
|
Note that the <literal>rate</literal> is only available once all file
|
|
transfers are completed.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>An apc.rfc1867 example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
print_r(apcu_fetch("upload_$_POST[APC_UPLOAD_PROGRESS]"));
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[total] => 1142543
|
|
[current] => 1142543
|
|
[rate] => 1828068.8
|
|
[filename] => test
|
|
[name] => file
|
|
[temp_filename] => /tmp/php8F
|
|
[cancel_upload] => 0
|
|
[done] => 1
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="ini.apcu.rfc1867-prefix">
|
|
<term>
|
|
<parameter>apc.rfc1867_prefix</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Key prefix to use for the user cache entry generated by rfc1867 upload
|
|
progress functionality.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="ini.apcu.rfc1867-name">
|
|
<term>
|
|
<parameter>apc.rfc1867_name</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Specify the hidden form entry name that activates APC upload progress
|
|
and specifies the user cache key suffix.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="ini.apcu.rfc1867-freq">
|
|
<term>
|
|
<parameter>apc.rfc1867_freq</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
The frequency that updates should be made to the user cache entry for
|
|
upload progress. This can take the form of a percentage of the total
|
|
file size or a size in bytes optionally suffixed with
|
|
<literal>"k"</literal>, <literal>"m"</literal>, or <literal>"g"</literal>
|
|
for kilobytes, megabytes, or gigabytes respectively (case insensitive).
|
|
A setting of 0 updates as often as possible, which may cause slower
|
|
uploads.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.rfc1867-ttl">
|
|
<term>
|
|
<parameter>apc.rfc1867_ttl</parameter>
|
|
<type>integer</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
<acronym>TTL</acronym> for rfc1867 entries.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.coredump-unmap">
|
|
<term>
|
|
<parameter>apc.coredump_unmap</parameter>
|
|
<type>boolean</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Enables APC handling of signals, such as SIGSEGV, that write
|
|
core files when signaled. When these signals are received,
|
|
APC will attempt to unmap the shared memory segment in order
|
|
to exclude it from the core file. This setting may improve
|
|
system stability when fatal signals are received and a large
|
|
APC shared memory segment is configured.
|
|
</para>
|
|
<warning>
|
|
<para>
|
|
This feature is potentially dangerous. Unmapping the shared
|
|
memory segment in a fatal signal handler may cause undefined
|
|
behaviour if a fatal error occurs.
|
|
</para>
|
|
</warning>
|
|
<note>
|
|
<para>
|
|
Although some kernels may provide a facility to ignore various
|
|
types of shared memory when generating a core dump file, these
|
|
implementations may also ignore important shared memory segments
|
|
such as the Apache scoreboard.
|
|
</para>
|
|
</note>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="ini.apcu.preload-path">
|
|
<term>
|
|
<parameter>apc.preload_path</parameter>
|
|
<type>string</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Optionally, set a path to the directory that APC will load
|
|
cache data at startup.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="ini.apcu.use-request-time">
|
|
<term>
|
|
<parameter>apc.use_request_time</parameter>
|
|
<type>bool</type>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Use the <acronym>SAPI</acronym> request start time for
|
|
<acronym>TTL</acronym>.
|
|
</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
|
|
-->
|