<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/phar.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'phar.configuration.php',
    1 => '运行时配置',
    2 => '运行时配置',
  ),
  'up' => 
  array (
    0 => 'phar.setup.php',
    1 => '安装/配置',
  ),
  'prev' => 
  array (
    0 => 'phar.installation.php',
    1 => '安装',
  ),
  'next' => 
  array (
    0 => 'phar.resources.php',
    1 => '资源类型',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/phar/ini.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="phar.configuration" class="section">
 <h2 class="title">运行时配置</h2>
 <p class="simpara">
这些函数的行为受 <var class="filename">php.ini</var> 中的设置影响。
</p>
 <p class="para">
  <table class="doctable table">
   <caption><strong>文件系统和 stream 配置选项</strong></caption>
   
    <thead>
     <tr>
      <th>名字</th>
      <th>默认</th>
      <th>可修改范围</th>
      <th>更新日志</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><a href="phar.configuration.php#ini.phar.readonly" class="link">phar.readonly</a></td>
      <td>&quot;1&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="phar.configuration.php#ini.phar.require-hash" class="link">phar.require_hash</a></td>
      <td>&quot;1&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="phar.configuration.php#ini.phar.cache-list" class="link">phar.cache_list</a></td>
      <td>&quot;&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

    </tbody>
   
  </table>

 </p>

 <p class="para">这是配置指令的简短说明。</p>

 <p class="para">
  <dl>
   
    <dt id="ini.phar.readonly">
     <code class="parameter">phar.readonly</code>
     <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
    </dt>
    <dd>
     <p class="para">
      在使用 <code class="literal">phar</code> 流或 <span class="classname"><a href="class.phar.php" class="classname">Phar</a></span> 对象的写入操作时，
      本选项可以禁止创建、修改 Phar 归档。
      在生产环境中推荐始终启用本设置，否则伴随其他常见安全漏洞，
      phar 扩展支持写入时也能创建基于 PHP 的病毒。
     </p>
     <blockquote class="note"><p><strong class="note">注意</strong>: 
      <p class="para">
       出于安全考虑，只能在 php.ini 中取消此设置。
       若在 php.ini 中禁用 <code class="literal">phar.readonly</code>，可以在代码中启用 <code class="literal">phar.readonly</code> 或其后禁用它。
       若在 php.ini 中启用 <code class="literal">phar.readonly</code>，在代码中只能 &quot;重复启用&quot; INI 变量，不能禁用。
      </p>
     </p></blockquote>
    </dd>
   

   
    <dt id="ini.phar.require-hash">
     <code class="parameter">phar.require_hash</code>
     <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>
    </dt>
    <dd>
     <p class="para">
      此选项要求调用的所有 Phar 归档必须包含签名（目前支持的签名类型有 MD5、SHA1、SHA256、SHA512、OpenSSL），
      而且会拒绝处理不含签名的 Phar 归档。
     </p>
     <blockquote class="note"><p><strong class="note">注意</strong>: 
      <p class="para">
       只能在 php.ini 中取消此设置。
       若在 php.ini 中禁用 <code class="literal">phar.require_hash</code>，可以在代码中启用 <code class="literal">phar.require_hash</code> 或其后禁用它。
       若在 php.ini 中启用 <code class="literal">phar.require_hash</code>，在代码中可以 &quot;重复启用&quot; INI 变量，但不能禁用它。
      </p>
      <p class="para">
       此选项不影响 <span class="classname"><a href="class.phardata.php" class="classname">PharData</a></span> 类读取普通 tar 文件。
      </p>
     </p></blockquote>
     <div class="caution"><strong class="caution">警告</strong>
      <p class="simpara">
       <code class="literal">phar.require_hash</code> 本身不提供任何安全保障，它只能阻止运行因意外而损坏的 Phar 归档，
       因为任何人都可以篡改 Phar 归档后轻松修改成对应的签名。
      </p>
     </div>
    </dd>
   

   
    <dt id="ini.phar.cache-list">
     <code class="parameter">phar.cache_list</code>
     <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
    </dt>
    <dd>
     <p class="para">
      允许 web 服务启动时预先解析映射 phar 归档，提供性能上的优化，
      使得从 phar 归档中运行文件的速度几乎接近从传统的基于磁盘安装运行这些文件的速度。
      <div class="example" id="example-1">
       <p><strong>示例 #1 phar.cache_list 用法示例</strong></p>
       <div class="example-contents">
<div class="cdata"><pre>
在 php.ini 中（windows）：
phar.cache_list =C:\path\to\phar1.phar;C:\path\to\phar2.phar
在 php.ini 中（unix）：
phar.cache_list =/path/to/phar1.phar:/path/to/phar2.phar
</pre></div>
       </div>

      </div>
     </p>
    </dd>
   
  </dl>
 </p>
</div><?php manual_footer($setup); ?>