How To Install PHP 8 on Fedora 35

Install PHP 8 on Fedora 35

In this tutorial, we will show you how to install PHP 8 on Fedora 35. For those of you who didn’t know, PHP is an open-source, general-purpose scripting language that is especially suited to web development but has also been used as a general-purpose programming language. PHP 8.1 is a significant update of the PHP language that will be “officially” released on November 25, 2021. This is a standard upgrade going forward from the existing PHP 8.0 release with the new PHP 8.1 is bringing enums, fibers, never return type, final class constants, and many more.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of PHP 8 on a Fedora 35.

Prerequisites

  • A server running one of the following operating systems: Fedora 35.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install PHP 8 on Fedora 35

Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:

sudo dnf upgrade
sudo dnf update
sudo dnf install dnf-plugins-core

Step 2. Installing PHP 8 on Fedora 35.

By default, PHP is not available on Fedora 35 base repository. Then we add the Remi repository  to your system with the following command below:

sudo dnf install http://rpms.remirepo.net/fedora/remi-release-35.rpm

After that, reset the PHP module and enable PHP 8 from the remi-8.0 module using the following command:

sudo dnf module reset php
sudo dnf config-manager --set-enabled remi
sudo dnf module enable php:remi-8.1

Finally, you can install PHP 8.0 with the following command below:

sudo dnf module install php:remi-8.1

Check installed version of PHP on your Fedora Linux:

$ php -v
PHP 8.1.0RC6 (cli) (built: Nov  20 2021 10:15:52) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.0-dev, Copyright (c) Zend Technologies

Step 3. Installing PHP 8 Extensions.

Optionally, if you would like to install PHP extensions using the name format php-<extension>. For example:

sudo dnf install php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

Congratulations! You have successfully installed PHP. Thanks for using this tutorial for installing PHP 8 on your Fedora 35 system. For additional help or useful information, we recommend you check the official PHP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!