<?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.dnf.php',
    1 => 'DNF を使用する GNU/Linux ディストリビューションでのパッケージからのインストール',
    2 => 'DNF を使用する GNU/Linux ディストリビューションでのパッケージからのインストール',
  ),
  'up' => 
  array (
    0 => 'install.unix.php',
    1 => 'Unix システムへのインストール',
  ),
  'prev' => 
  array (
    0 => 'install.unix.debian.php',
    1 => 'Debian GNU/Linux および関連ディストリビューションのパッケージからのインストール',
  ),
  'next' => 
  array (
    0 => 'install.unix.openbsd.php',
    1 => 'OpenBSD パッケージまたは ports からのインストール',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'install/unix/dnf.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="install.unix.dnf" class="sect1">
 <h2 class="title">DNF を使用する GNU/Linux ディストリビューションでのパッケージからのインストール</h2>
 <p class="simpara">
  PHP はソースコードからインストールできますが、Red Hat Enterprise Linux、
  OpenSUSE、Fedora、CentOS、Rocky Linux、Oracle Enterprise Linux のような
  DNF を使用するシステム上のパッケージからインストールすることもできます。
 </p>
 <div class="warning"><strong class="warning">警告</strong>
 <p class="para">
  サードパーティによるビルドは非公式であり、PHP プロジェクトによって
  直接サポートされません。発生したバグは、
  <a href="https://www.php.net/downloads.php" class="link external">&raquo;&nbsp;公式ダウンロードページ</a>
  からのビルドで再現できなければ、非公式ビルドの提供元に報告してください。
 </p>
</div>
 <p class="simpara">
  パッケージは <strong class="command">dnf</strong> コマンドでインストールできます。
 </p>
 <div class="sect2" id="install.unix.dnf.packages">
  <h3 class="title">Installing packages</h3>
  <p class="simpara">
   まず、<a href="https://pear.php.net/" class="link external">&raquo;&nbsp;PEAR</a> には <code class="literal">php-pear</code>、
   <a href="book.mysqlnd.php" class="link">MySQL 拡張</a> には <code class="literal">php-mysqlnd</code>
   など、 他の関連パッケージが必要になる場合があることに気をつけてください。
  </p>
  <p class="simpara">
   次に、パッケージをインストールする前に、パッケージリストが最新であることを確認するのが賢明です。
   通常、これは <strong class="command">dnf update</strong> コマンドを実行して行います。
  </p>
  <div class="example" id="install.unix.dnf.example">
   <p><strong>例1 DNF インストールの例</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># dnf install php php-common</pre>
</div>
   </div>

  </div>
  <p class="simpara">
   DNF は Web サーバー に自動的に PHP のための設定をインストールしますが、
   変更を有効化するには、以下のようなコマンドでサーバーの再起動が必要になる場合があります。
  </p>
  <div class="example" id="install.unix.dnf.example2">
   <p><strong>例2 Restarting Apache once PHP is installed</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># sudo systemctl restart httpd</pre>
</div>
   </div>

  </div>
 </div>
 <div class="sect2" id="install.unix.dnf.config">
  <h3 class="title">設定のよりよい管理方法</h3>
  <p class="para">
   これまでのセクションでは、PHP はコアモジュールのみをインストールしました。
   次のような追加モジュールが必要になる可能性が非常に高くなります。
   <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>
   これらのモジュールも <strong class="command">dnf</strong> コマンドでインストールできます。
  </p>
  <div class="example" id="install.unix.dnf.config.example">
   <p><strong>例3 追加の PHP パッケージを一覧する方法</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># dnf search php</pre>
</div>
   </div>

  </div>
  <p class="simpara">
   パッケージのリストには、<code class="literal">php-cli</code>、<code class="literal">php-fpm</code>、
   <code class="literal">php-devel</code> などの基本的な PHP コンポーネントや、多くの PHP
   拡張モジュールを含む数多くのパッケージが含まれています。拡張モジュールがインストールされると、
   それらのパッケージの依存関係を満たすために、
   必要に応じて追加のパッケージが自動的にインストールされます。
  </p>
  <div class="example" id="install.unix.dnf.config.example2">
   <p><strong>例4 Install PHP with MySQL, GD</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># dnf install php-mysqlnd php-gd</pre>
</div>
   </div>

  </div>
  <p class="simpara">
   DNF は、<var class="filename">/etc/php/8.3/php.ini</var>、<var class="filename">/etc/php/8.3/conf.d/*.ini</var>
   などのさまざまな <var class="filename">php.ini</var> 関連ファイルに適切な行を自動的に追加し、
   拡張モジュールに応じて <code class="literal">extension=foo.so</code> のようなエントリを追加します。
   ただし、これらの変更の有効化するには、Web サーバー (Apache など) を再起動しなければなりません。
  </p>
 </div>
</div><?php manual_footer($setup); ?>