<?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 => 'it',
  ),
  'this' => 
  array (
    0 => 'install.unix.dnf.php',
    1 => 'Installing from packages on GNU/Linux distributions that use DNF',
    2 => 'Installing from packages on GNU/Linux distributions that use DNF',
  ),
  'up' => 
  array (
    0 => 'install.unix.php',
    1 => 'Installazione su sistemi Unix',
  ),
  'prev' => 
  array (
    0 => 'install.unix.debian.php',
    1 => 'Installing from packages on Debian GNU/Linux and related distributions',
  ),
  'next' => 
  array (
    0 => 'install.unix.openbsd.php',
    1 => 'Installing from packages or ports on OpenBSD',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    '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">Installing from packages on GNU/Linux distributions that use DNF</h2>
 <p class="simpara">
  While PHP can be installed from source, it is also available through
  packages on systems that use DNF, such as Red Hat Enterprise Linux,
  OpenSUSE, Fedora, CentOS, Rocky Linux, and Oracle Enterprise Linux.
 </p>
 <div class="warning"><strong class="warning">Avviso</strong>
 <p class="para">
  Builds from third-parties are considered unofficial and not directly
  supported by the PHP project. Any bugs encountered should be reported to the
  provider of those unofficial builds unless they can be reproduced using the
  builds from <a href="https://www.php.net/downloads.php" class="link external">&raquo;&nbsp;the official download
  area</a>.
 </p>
</div>
 <p class="simpara">
  The packages can be installed using the <strong class="command">dnf</strong> command.
 </p>
 <div class="sect2" id="install.unix.dnf.packages">
  <h3 class="title">Installing packages</h3>
  <p class="simpara">
   First, note that other related packages may be desired like
   <code class="literal">php-pear</code> for <a href="https://pear.php.net/" class="link external">&raquo;&nbsp;PEAR</a>,
   or <code class="literal">php-mysqlnd</code> for the <a href="book.mysqlnd.php" class="link">MySQL
   extension</a>.
  </p>
  <p class="simpara">
   Second, before installing a package, it&#039;s wise to ensure the package list
   is up to date. Typically, this is done by running the command
   <strong class="command">dnf update</strong>.
  </p>
  <div class="example" id="install.unix.dnf.example">
   <p><strong>Example #1 DNF Install Example</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 will automatically install the configuration for PHP for the web server,
   but it may need to be restarted in order for the changes to take effect.
   For example:
  </p>
  <div class="example" id="install.unix.dnf.example2">
   <p><strong>Example #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">Better control of configuration</h3>
  <p class="para">
   In the last section, PHP was installed with only core modules. It&#039;s
   very likely that additional modules will be desired, such as
   <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>, etc.</span>
   These may also be installed via the <strong class="command">dnf</strong> command.
  </p>
  <div class="example" id="install.unix.dnf.config.example">
   <p><strong>Example #3 Methods for listing additional PHP packages</strong></p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode"># dnf search php</pre>
</div>
   </div>

  </div>
  <p class="simpara">
   The list of packages will include a large number of packages that includes
   basic PHP components, such as <code class="literal">php-cli</code>,
   <code class="literal">php-fpm</code>, and <code class="literal">php-devel</code>, as well as
   many PHP extensions. When extensions are installed, additional packages
   will be automatically installed as necessary to satisfy the dependencies
   of those packages.
  </p>
  <div class="example" id="install.unix.dnf.config.example2">
   <p><strong>Example #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 will automatically add the appropriate lines to the
   different <var class="filename">php.ini</var> related files like
   <var class="filename">/etc/php/8.3/php.ini</var>,
   <var class="filename">/etc/php/8.3/conf.d/*.ini</var>, etc. and depending on
   the extension will add entries similar to <code class="literal">extension=foo.so</code>.
   However, restarting the web server (like Apache) is required before these
   changes take affect.
  </p>
 </div>
</div><?php manual_footer($setup); ?>