<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/opcache.setup.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'opcache.installation.php',
    1 => 'インストール手順',
    2 => 'インストール手順',
  ),
  'up' => 
  array (
    0 => 'opcache.setup.php',
    1 => 'インストール/設定',
  ),
  'prev' => 
  array (
    0 => 'opcache.setup.php',
    1 => 'インストール/設定',
  ),
  'next' => 
  array (
    0 => 'opcache.configuration.php',
    1 => '実行時設定',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/opcache/configure.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="opcache.installation" class="sect1">
 <h2 class="title">インストール手順</h2>

 <p class="simpara">
  OPcache は共有ライブラリ形式の拡張モジュールとしてしかコンパイルできません。
  <strong class="option configure">--disable-all</strong> を指定してデフォルトでコンパイルされる拡張モジュールを無効にしている場合は、OPcache が利用可能になるように <strong class="option configure">--enable-opcache</strong> オプションを使って PHP をコンパイルしなければいけません。
 </p>

 <p class="simpara">
  いったんコンパイルすると、<a href="ini.core.php#ini.zend-extension" class="link">zend_extension</a> 設定ディレクティブを使って OPcache を PHP にロードできます。これは <code class="literal">zend_extension=/full/path/to/opcache.so</code> という設定で行えます。Windows の場合は <code class="literal">zend_extension=C:\path\to\php_opcache.dll</code> を使います。
 </p>

 <blockquote class="note"><p><strong class="note">注意</strong>: 
  <span class="simpara">
   OPcache を <a href="http://xdebug.org/" class="link external">&raquo;&nbsp;Xdebug</a> と一緒に使う場合は、OPcache を Xdebug より前にロードさせなければいけません。
  </span>
 </p></blockquote>

 <div class="sect2" id="opcache.installation.recommended">
  <h3 class="title">推奨される php.ini の設定</h3>

  <p class="simpara">
   良好なパフォーマンスを得るために、一般的に推奨される設定は次の通りです。
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="cdata"><pre>
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1 ; PHP 7.2.0 より前のバージョンで有効
opcache.enable_cli=1
</pre></div>
   </div>

  </div>

  <p class="simpara">
   <a href="opcache.configuration.php#ini.opcache.save-comments" class="link">opcache.save_comments</a> を無効にし、
   <a href="opcache.configuration.php#ini.opcache.enable-file-override" class="link">opcache.enable_file_override</a> を有効にしたいと思うかもしれませんが、この設定を行う前に実運用環境であなたのコードを必ずテストするようにしてください。なぜなら、この設定は特にドキュメント向けのコメントやアノテーションを使っている場合に、既存のフレームワークやアプリケーションが壊れることが既知の現象としてあるからです。
  </p>

  <p class="simpara">
   Windows では、
   <a href="opcache.configuration.php#ini.opcache.file-cache-fallback" class="link">opcache.file_cache_fallback</a> を有効にすべきです。
   かつ、既に存在し、書き込み可能なディレクトリを
   <a href="opcache.configuration.php#ini.opcache.file-cache" class="link">opcache.file_cache</a> に設定すべきです。
  </p>

  <p class="simpara">
   OPcache がサポートしている設定ディレクティブの完全なリストは
   <a href="opcache.configuration.php" class="link">実行時設定</a> のページにあります。
  </p>
 </div>
</div><?php manual_footer($setup); ?>