|
Installing from packages on GNU/Linux distributions that use DNFWhile 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. Warning
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 » the official download area. The packages can be installed using the dnf command. Installing packages
First, note that other related packages may be desired like
Second, before installing a package, it's wise to ensure the package list is up to date. Typically, this is done by running the command dnf update. Example #1 DNF Install Example # dnf install php php-common 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: Example #2 Restarting Apache once PHP is installed # sudo systemctl restart httpd Better control of configurationIn the last section, PHP was installed with only core modules. It's very likely that additional modules will be desired, such as These may also be installed via the dnf command.Example #3 Methods for listing additional PHP packages # dnf search php
The list of packages will include a large number of packages that includes
basic PHP components, such as Example #4 Install PHP with MySQL, GD # dnf install php-mysqlnd php-gd
DNF will automatically add the appropriate lines to the
different php.ini related files like
/etc/php/8.3/php.ini,
/etc/php/8.3/conf.d/*.ini, etc. and depending on
the extension will add entries similar to |