|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- $Revision$ --> |
| 3 | +<sect1 xml:id="install.unix.dnf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 4 | + <title>Installing from packages on GNU/Linux distributions that use DNF</title> |
| 5 | + <simpara> |
| 6 | + While PHP can be installed from source, it is also available through |
| 7 | + packages on systems that use DNF, such as Red Hat Enterprise Linux, |
| 8 | + OpenSUSE, Fedora, CentOS, Rocky Linux, and Oracle Enterprise Linux. |
| 9 | + </simpara> |
| 10 | + &warn.install.third-party-support; |
| 11 | + <simpara> |
| 12 | + The packages can be installed using the <command>dnf</command> command. |
| 13 | + </simpara> |
| 14 | + <sect2 xml:id="install.unix.dnf.packages"> |
| 15 | + <title>Installing packages</title> |
| 16 | + <simpara> |
| 17 | + First, note that other related packages may be desired like |
| 18 | + <literal>php-pear</literal> for <link xlink:href="&url.pear;">PEAR</link>, |
| 19 | + or <literal>php-mysqlnd</literal> for the <link linkend="book.mysqlnd">MySQL |
| 20 | + extension</link>. |
| 21 | + </simpara> |
| 22 | + <simpara> |
| 23 | + Second, before installing a package, it's wise to ensure the package list |
| 24 | + is up to date. Typically, this is done by running the command |
| 25 | + <command>dnf update</command>. |
| 26 | + </simpara> |
| 27 | + <example xml:id="install.unix.dnf.example"> |
| 28 | + <title>DNF Install Example</title> |
| 29 | + <programlisting role="shell"> |
| 30 | +<![CDATA[ |
| 31 | +# dnf install php php-common |
| 32 | +]]> |
| 33 | + </programlisting> |
| 34 | + </example> |
| 35 | + <simpara> |
| 36 | + DNF will automatically install the configuration for PHP for the web server, |
| 37 | + but it may need to be restarted in order for the changes to take effect. |
| 38 | + For example: |
| 39 | + </simpara> |
| 40 | + <example xml:id="install.unix.dnf.example2"> |
| 41 | + <title>Restarting Apache once PHP is installed</title> |
| 42 | + <programlisting role="shell"> |
| 43 | +<![CDATA[ |
| 44 | +# sudo systemctl restart httpd |
| 45 | +]]> |
| 46 | + </programlisting> |
| 47 | + </example> |
| 48 | + </sect2> |
| 49 | + <sect2 xml:id="install.unix.dnf.config"> |
| 50 | + <title>Better control of configuration</title> |
| 51 | + <para> |
| 52 | + In the last section, PHP was installed with only core modules. It's |
| 53 | + very likely that additional modules will be desired, such as |
| 54 | + <simplelist type="inline"> |
| 55 | + <member><link linkend="book.mysql">MySQL</link></member> |
| 56 | + <member><link linkend="book.curl">cURL</link></member> |
| 57 | + <member><link linkend="book.image">GD</link></member> |
| 58 | + <member>etc.</member> |
| 59 | + </simplelist> |
| 60 | + These may also be installed via the <command>dnf</command> command. |
| 61 | + </para> |
| 62 | + <example xml:id="install.unix.dnf.config.example"> |
| 63 | + <title>Methods for listing additional PHP packages</title> |
| 64 | + <programlisting role="shell"> |
| 65 | +<![CDATA[ |
| 66 | +# dnf search php |
| 67 | +]]> |
| 68 | + </programlisting> |
| 69 | + </example> |
| 70 | + <simpara> |
| 71 | + The list of packages will include a large number of packages that includes |
| 72 | + basic PHP components, such as <literal>php-cli</literal>, |
| 73 | + <literal>php-fpm</literal>, and <literal>php-devel</literal>, as well as |
| 74 | + many PHP extensions. When extensions are installed, additional packages |
| 75 | + will be automatically installed as necessary to satisfy the dependencies |
| 76 | + of those packages. |
| 77 | + </simpara> |
| 78 | + <example xml:id="install.unix.dnf.config.example2"> |
| 79 | + <title>Install PHP with MySQL, GD</title> |
| 80 | + <programlisting role="shell"> |
| 81 | +<![CDATA[ |
| 82 | +# dnf install php-mysqlnd php-gd |
| 83 | +]]> |
| 84 | + </programlisting> |
| 85 | + </example> |
| 86 | + <simpara> |
| 87 | + DNF will automatically add the appropriate lines to the |
| 88 | + different &php.ini; related files like |
| 89 | + <filename>/etc/php/8.3/php.ini</filename>, |
| 90 | + <filename>/etc/php/8.3/conf.d/*.ini</filename>, etc. and depending on |
| 91 | + the extension will add entries similar to <literal>extension=foo.so</literal>. |
| 92 | + However, restarting the web server (like Apache) is required before these |
| 93 | + changes take affect. |
| 94 | + </simpara> |
| 95 | + </sect2> |
| 96 | +</sect1> |
| 97 | +<!-- Keep this comment at the end of the file |
| 98 | +Local variables: |
| 99 | +mode: sgml |
| 100 | +sgml-omittag:t |
| 101 | +sgml-shorttag:t |
| 102 | +sgml-minimize-attributes:nil |
| 103 | +sgml-always-quote-attributes:t |
| 104 | +sgml-indent-step:1 |
| 105 | +sgml-indent-data:t |
| 106 | +indent-tabs-mode:nil |
| 107 | +sgml-parent-document:nil |
| 108 | +sgml-default-dtd-file:"~/.phpdoc/manual.ced" |
| 109 | +sgml-exposed-tags:nil |
| 110 | +sgml-local-catalogs:nil |
| 111 | +sgml-local-ecat-files:nil |
| 112 | +End: |
| 113 | +vim600: syn=xml fen fdm=syntax fdl=2 si |
| 114 | +vim: et tw=78 syn=sgml |
| 115 | +vi: ts=1 sw=1 |
| 116 | +--> |
0 commit comments