Install PHP 8 on Fedora 35 - Step by step guide ?

Install PHP 8 on Fedora 35 - Step by step guide ?

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.

Here at Fixwebnode, as part of our Server Management Services, we regularly help our Customers to perform related PHP queries.

In this context, we shall look into how to install PHP 8 on Fedora 35.

 

Steps to Install PHP 8 on Fedora 35

1. Perform System Update

To start off, you need to update your Fedora operating system to make sure all existing packages are up to date by running the below commands:

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

 

2. Install PHP 8 on the system

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

 

3. Install 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

 

[Need to configure PHP on your Linux system ? We can help you. ]

 


Conclusion

This article covers the steps to install PHP 8 on your Fedora 35 system. In fact, PHP 8.1 is a significant update of the PHP language that will be "officially" released on November 25, 2021. Note that you may find that many of your favorite software like WordPress or Plugins / Themes for CMS software may conflict until developers can update.

 

About PHP-FPM Installations of PHP 8.1

1. Firstly, open following (www.conf) configuration file:

$ sudo nano /etc/php-fpm.d/www.conf

2. Next, replace the (Apache) user and group with the (Nginx) user and group.

3. To save, press (CTRL+O) then exit (CTRL+X).

4. Now you will too reload or restart your PHP-FPM service:

$ sudo systemctl restart php-fpm

5. The Nginx server block needs the following example below for Nginx to process the PHP files:

server {
 # … some other code
 # Pass the php scripts to FastCGI server specified in upstream declaration.
location ~ \.php(/|$) {
include fastcgi.conf;
                fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
try_files $uri $uri/ /app.php$is_args$args;
fastcgi_intercept_errors on;
}
}

6. Test Nginx to make sure you have no errors with the adjustments made with the code above; enter the following:

$ sudo nginx -t

7. Finally, Restart Nginx service for installation to be complete:

$ sudo systemctl restart nginx

 


icon

Sign up to our Newsletter

...and get one free support ticket.