<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/install.unix.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'install.unix.alpine.php',
    1 => 'Alpine Linux でのパッケージからのインストール',
    2 => 'Alpine Linux でのパッケージからのインストール',
  ),
  'up' => 
  array (
    0 => 'install.unix.php',
    1 => 'Unix システムへのインストール',
  ),
  'prev' => 
  array (
    0 => 'install.unix.dnf.php',
    1 => 'DNF を使用する GNU/Linux ディストリビューションでのパッケージからのインストール',
  ),
  'next' => 
  array (
    0 => 'install.unix.pacman.php',
    1 => 'Arch Linux でのパッケージからのインストール',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'install/unix/alpine.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="install.unix.alpine" class="sect1">
 <h2 class="title">Alpine Linux でのパッケージからのインストール</h2>
 <p class="simpara">
  PHP はソースコードからインストールできますが、<strong class="command">apk</strong>
  パッケージマネージャを使う Alpine Linux とその派生ディストリビューションでは、
  パッケージからインストールすることもできます。
 </p>
 <div class="warning"><strong class="warning">警告</strong>
 <p class="simpara">
  サードパーティによるビルドは非公式であり、PHP プロジェクトによって
  直接サポートされません。発生したバグは、
  <a href="https://www.php.net/downloads.php" class="link external">&raquo;&nbsp;公式ダウンロードページ</a>
  からのビルドで再現できなければ、非公式ビルドの提供元に報告してください。
 </p>
</div>
 <p class="simpara">
  パッケージは <strong class="command">apk</strong> パッケージマネージャでインストールできます。
 </p>
 <div class="sect2" id="install.unix.alpine.packages">
  <h3 class="title">パッケージのインストール</h3>
  <p class="simpara">
   Alpine Linux の PHP パッケージは、名前にメジャーバージョン番号を含みます
   (例: PHP 8.3 なら <code class="literal">php83</code>)。以下の例では、<code class="literal">83</code>
   を、お使いの Alpine Linux のリリースで利用できる PHP のバージョンに読み替えてください。
  </p>
  <p class="simpara">
   パッケージをインストールする前に、<strong class="command">apk update</strong> を実行して、
   パッケージインデックスが最新であることを確認してください。
  </p>
  <div class="example" id="install.unix.alpine.example">
   <p><strong>例1 Alpine インストールの例</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># apk add php83</pre>
</div>
   </div>

  </div>
  <p class="simpara">
   Alpine は、Web サーバー用の PHP の設定を自動的には行いません。
   FastCGI 構成の場合は、<code class="literal">php83-fpm</code> をインストールし、
   OpenRC サービス <code class="literal">php-fpm83</code> を有効にします
   (パッケージ名とサービス名とで、バージョン番号の付く位置が異なる点に注意してください)。
   たとえば、次のようにします。
  </p>
  <div class="example" id="install.unix.alpine.example2">
   <p><strong>例2 PHP-FPM の有効化と起動</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># apk add php83-fpm
# rc-update add php-fpm83 default
# rc-service php-fpm83 start</pre>
</div>
   </div>

  </div>
 </div>
 <div class="sect2" id="install.unix.alpine.config">
  <h3 class="title">設定のよりよい管理方法</h3>
  <p class="para">
   ベースパッケージでインストールされるのは、コアの拡張モジュールだけです。
   追加の拡張モジュール、たとえば
   <span class="simplelist"><a href="book.mysql.php" class="link">MySQL</a>, <a href="book.curl.php" class="link">cURL</a>, <a href="book.image.php" class="link">GD</a>, など</span>
   は、個別のパッケージとしてインストールできます。
  </p>
  <div class="example" id="install.unix.alpine.config.example">
   <p><strong>例3 利用可能な PHP パッケージを検索する</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># apk search php83</pre>
</div>
   </div>

  </div>
  <p class="simpara">
   パッケージの一覧には、CLI や FPM のほか、多くの拡張モジュールが含まれています。
   拡張モジュールをインストールすると、その依存関係は自動的に解決されます。
  </p>
  <div class="example" id="install.unix.alpine.config.example2">
   <p><strong>例4 PHP と MySQL、GD のインストール</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># apk add php83-mysqli php83-gd</pre>
</div>
   </div>

  </div>
  <p class="simpara">
   拡張モジュールはインストール時に自動的に有効になるので、<var class="filename">php.ini</var>
   を手動で編集する必要はありません。設定ファイルは
   <var class="filename">/etc/php83/conf.d/</var> に置かれます。
   新しい拡張モジュールをインストールしたあとは、変更を反映するために PHP-FPM
   (もしくは Web サーバー) を再起動する必要があります。
  </p>
 </div>
</div><?php manual_footer($setup); ?>