\n
$ sudo dnf install https:\/\/dl.fedoraproject.org\/pub\/epel\/epel-release-latest-9.noarch.rpm<\/p>\n<\/div><\/div>\n\n\n\n <\/figure>\n\n\n\nTo confirm that EPEL has been added, run:<\/p>\n\n\n\n
\n
$ rpm -qi epel-release<\/p>\n<\/div><\/div>\n\n\n\n
The output provides detailed information about the package, including the name, version, release, and architecture.<\/p>\n\n\n\n <\/figure>\n\n\n\nStep 2: Install Remi Repository<\/h2>\n\n\n\n Once the EPEL repository is added, the next step is to add the Remi repository. As mentioned earlier, the Remi repository provides the latest releases of PHP.<\/p>\n\n\n\n
To add the Remi repository, execute the command below.<\/p>\n\n\n\n
\n
$ sudo dnf -y install http:\/\/rpms.remirepo.net\/enterprise\/remi-release-9.rpm -y<\/p>\n<\/div><\/div>\n\n\n\n <\/figure>\n\n\n\nOnce installed, you can confirm its installation as shown.<\/p>\n\n\n\n
\n
$ rpm -qi remi-release<\/p>\n<\/div><\/div>\n\n\n\n <\/figure>\n\n\n\nBefore installing PHP, we need to check the available PHP streams in the repository. To do so, run the following command:<\/p>\n\n\n\n
\n
$ sudo dnf module list php -y<\/p>\n<\/div><\/div>\n\n\n\n <\/figure>\n\n\n\nFrom the output, remi-8.3 is the latest stream in the repository. However, we will add the remi-8.2 release, which provides PHP 8.2 , the latest stable version of PHP.<\/p>\n\n\n\n
The next step is to reset the default PHP module residing on the system.<\/p>\n\n\n\n
\n
$ sudo dnf module reset php -y<\/p>\n<\/div><\/div>\n\n\n\n <\/figure>\n\n\n\nNext, enable the remi-8.2 stream by specifying the repository name and version number.<\/p>\n\n\n\n
\n
$ sudo dnf module enable php:remi-8.2 -y<\/p>\n<\/div><\/div>\n\n\n\n <\/figure>\n\n\n\nWith the latest module stream enabled, proceed and install PHP 8 as shown.<\/p>\n\n\n\n
\n
$ sudo dnf install php -y<\/p>\n<\/div><\/div>\n\n\n\n <\/figure>\n\n\n\nOnce installed, confirm the version of PHP installed.<\/p>\n\n\n\n
\n
$ php -v<\/p>\n<\/div><\/div>\n\n\n\n
From the output, you can see that we have installed the latest version of PHP which is PHP 8.2<\/p>\n\n\n\n <\/figure>\n\n\n\nStep 3: Install Additional PHP Extensions (Optional)<\/h2>\n\n\n\n PHP extensions play an integral part in the PHP ecosystem. A PHP extension is a compiled library that extends the functionality of PHP and meets the needs of various types of applications. For example, the php-mysql<\/strong> extension allows you to connect to a MySQL database, and php-zip<\/strong> enables you to unpack or create zip files. PHP provides over 150 extensions for various functionalities. Use these only as required and keep all code dependencies and third-party components up to date.<\/p>\n\n\n\nTo install a PHP extension, use the following syntax:<\/p>\n\n\n\n