apc.configuration.html
来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 902 行 · 第 1/2 页
HTML
902 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Runtime Configuration</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="apc.installation.html">Installation</a></div> <div class="next" style="text-align: right; float: right;"><a href="apc.resources.html">Resource Types</a></div> <div class="up"><a href="apc.setup.html">Installing/Configuring</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="apc.configuration" class="section"> <h2 class="title">Runtime Configuration</h2> <p class="simpara">The behaviour of these functions is affected by settings in <var class="filename">php.ini</var>.</p> <p class="para"> Although the default APC settings are fine for many installations, serious users should consider tuning the following parameters. </p> <p class="para"> There are two main decisions you have to make. First, how much shared memory do you want to set aside for APC, and second, whether you want APC to check if a file has been modified on every request. The two ini directives involved here are <i>apc.shm_size</i> and <i>apc.stat</i>. Read the sections on these two directives carefully below. </p> <p class="para"> Once you have a running server, you should copy the <i>apc.php</i> script that comes with the extension to somewhere in your docroot and load it up in your browser. It provides you with a detailed look at what is happening in your cache. If you have GD enabled in PHP, it will even have pretty graphs. First thing to check is of course that it is actually caching files. Assuming it is working you should then pay close attention to the <i>Cache full count</i> number on the left. That tells you the number of times the cache has filled up and has had to forcefully clean up any entries not accessed within the last <i>apc.ttl</i> seconds. You should configure your cache to minimize this number. If you are constantly filling your cache, the resulting cache churn is going to hurt performance. You should either set more memory aside for APC, or use <i>apc.filters</i> to cache fewer scripts. </p> <p class="para"> <table border="5"> <caption><b>APC configuration options</b></caption> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Name</th> <th colspan="1">Default</th> <th colspan="1">Changeable</th> <th colspan="1">Changelog</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.enabled</td> <td colspan="1" rowspan="1" align="left">"1"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM in APC 2. PHP_INI_ALL in APC <= 3.0.12.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.shm_segments</td> <td colspan="1" rowspan="1" align="left">"1"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.shm_size</td> <td colspan="1" rowspan="1" align="left">"30"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.optimization</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM in APC 2. Removed in APC 3.0.13.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.num_files_hint</td> <td colspan="1" rowspan="1" align="left">"1000"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.user_entries_hint</td> <td colspan="1" rowspan="1" align="left">"4096"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.ttl</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.user_ttl</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.gc_ttl</td> <td colspan="1" rowspan="1" align="left">"3600"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.cache_by_default</td> <td colspan="1" rowspan="1" align="left">"1"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_ALL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM in APC <= 3.0.12. Available since APC 3.0.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.filters</td> <td colspan="1" rowspan="1" align="left">NULL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.mmap_file_mask</td> <td colspan="1" rowspan="1" align="left">NULL</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.slam_defense</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.0.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.file_update_protection</td> <td colspan="1" rowspan="1" align="left">"2"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.6.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.enable_cli</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.7.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.max_file_size</td> <td colspan="1" rowspan="1" align="left">"1M"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.7.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.stat</td> <td colspan="1" rowspan="1" align="left">"1"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.10.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.write_lock</td> <td colspan="1" rowspan="1" align="left">"1"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.11.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.report_autofilter</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.11.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.include_once_override</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.12.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.rfc1867</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.13.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.rfc1867_prefix</td> <td colspan="1" rowspan="1" align="left">"upload_"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.rfc1867_name</td> <td colspan="1" rowspan="1" align="left">"APC_UPLOAD_PROGRESS"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.rfc1867_freq</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td class="empty"> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.localcache</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.14.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.localcache.size</td> <td colspan="1" rowspan="1" align="left">"512"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.14.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">apc.coredump_unmap</td> <td colspan="1" rowspan="1" align="left">"0"</td> <td colspan="1" rowspan="1" align="left">PHP_INI_SYSTEM</td> <td colspan="1" rowspan="1" align="left">Available since APC 3.0.16.</td> </tr> </tbody> </colgroup> </table> For further details and definitions of the PHP_INI_* constants, see the <a href="ini.html" class="xref">php.ini directives</a>. </p> <p class="para">Here's a short explanation ofthe configuration directives.</p> <p class="para"> <dl> <dt id="ini.apc.enabled"> <span class="term"> <i><tt class="parameter">apc.enabled</tt></i> <a href="language.types.boolean.html" class="type boolean">boolean</a> </span> <dd> <p class="para"> <i>apc.enabled</i> 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 <i>extension</i> line in <i>php.ini</i> can just be commented-out). </p> </dd> </dt> <dt id="ini.apc.shm-segments"> <span class="term"> <i><tt class="parameter">apc.shm_segments</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="para"> The number of shared memory segments to allocate for the compiler cache. If APC is running out of shared memory but you have already set <i>apc.shm_size</i> as high as your system allows, you can try raising this value. </p> </dd> </dt> <dt id="ini.apc.shm-size"> <span class="term"> <i><tt class="parameter">apc.shm_size</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="para"> The size of each shared memory segment in MB. By default, some systems (including most BSD variants) have very low limits on the size of a shared memory segment. </p> </dd> </dt> <dt id="ini.apc.optimization"> <span class="term"> <i><tt class="parameter">apc.optimization</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="para"> The optimization level. Zero disables the optimizer, and higher values use more aggressive optimizations. Expect very modest speed improvements. This is experimental. </p> </dd> </dt> <dt id="ini.apc.num-files-hint"> <span class="term"> <i><tt class="parameter">apc.num_files_hint</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="para"> A "hint" about the number of distinct source files that will be included or requested on your web server. Set to zero or omit if you're not sure; this setting is mainly useful for sites that have many thousands of source files. </p> </dd> </dt> <dt id="ini.apc.user-entries-hint"> <span class="term"> <i><tt class="parameter">apc.user_entries_hint</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="para"> Just like <a href="apc.configuration.html#ini.apc.num-files-hint" class="link">apc.num_files_hint</a>, a "hint" about the number of distinct user cache variables to store. Set to zero or omit if not sure. </p> </dd> </dt> <dt id="ini.apc.ttl"> <span class="term"> <i><tt class="parameter">apc.ttl</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="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 your cache could potentially fill up with stale entries while newer entries won't be cached. </p> </dd> </dt> <dt id="ini.apc.user-ttl"> <span class="term"> <i><tt class="parameter">apc.user_ttl</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="para"> The number of seconds a user 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 your cache could potentially fill up with stale entries while newer entries won't be cached. </p> </dd> </dt> <dt id="ini.apc.gc-ttl"> <span class="term"> <i><tt class="parameter">apc.gc_ttl</tt></i> <a href="language.types.integer.html" class="type integer">integer</a> </span> <dd> <p class="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. </p> </dd> </dt> <dt id="ini.apc.cache-by-default"> <span class="term"> <i><tt class="parameter">apc.cache_by_default</tt></i> <a href="language.types.boolean.html" class="type boolean">boolean</a> </span> <dd>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?