We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install PHP 8.1 on Fedora 37/36/35/34/33/32

Learn how to – How To Install PHP 8.1 on Fedora 37/36/35/34/33/32.

Are you looking for an easy way to install PHP 8.1 on Fedora 37/36/35/34/33/32?. PHP 8.1 packages for Fedora operating system are available in the Remi repository. PHP is a general-purpose scripting language suit for creation of dynamic web pages and powerful web applications. PHP was originally created by Rasmus Lerdorf in 1994.

In this tutorial we shall discuss on the steps required to install and run PHP 8.1 on Fedora Linux system. This can be on a cloud instance, on-prem server installation of Fedora, or on your Fedora workstation system.

New Features in PHP 8.1

Below are some new features in PHP 8.1 release. More details about each feature is available in the official PHP website.

  • Readonly properties â€“ Class properties can be marked as readonly hence can only be written once
  • Support for DNS-over-HTTPS (DoH)
  • AVIF Image Format support â€“ The PHP 8.1’s image processing and GD extension adds support for AVIF images.
  • Never Return Type â€“ A new return type hint called never is added in PHP 8.1
  • Added support for Fibers â€“ The low level mechanism to manage parallelism
  • PHP 8.1 adds array_is_list as a built-in function
  • File Uploads with CURLStringFile â€“ In PHP 8.1, PHP Curl extension now supports HTTP(S) requests with file uploads
  • Enums â€“ They are now added in PHP 8.1
  • New fdatasync() and fsync() Functions
  • New Sodium XChaCha20 functions
  • Addition of pure intersection types feature
  • Explicit Octal Numeral Notation
  • Define final Class Constants
  • MurmurHash3 hash algorithm support
  • Intersection Types
  • xxHash hash algorithms support
  • For detailed information read through the official PHP 8.1 notes

Install PHP 8.1 on Fedora 37/36/35/34/33/32

For normal PHP requirements, you can go with the latest version available on the default Fedora RPM repositories. For any version of PHP not in the default repos, you’ll be required to add third party repository such as REMI or build from source.

Step 1: Enable Remi repository on Fedora

Perform an update on your Fedora system

sudo dnf -y update

Then proceed to enable Remi repository on Fedora.

Fedora 37:

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

Fedora 36:

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

Fedora 35:

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

Fedora 34:

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

Fedora 33:

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

Step 2: Install PHP 8.1 on Fedora

After addition of REMI repository, disable default AppStream PHP module.

sudo dnf -y module reset php

Enable php:remi-8.1 module

sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --set-enabled remi
sudo dnf -y module install php:remi-8.1

Check installed version of PHP on your Fedora Linux:

$ php --version
PHP 8.1.14 (cli) (built: Jan  4 2023 06:45:14) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies

Installing multiple versions of PHP

If you’re interested in having multiple versions of PHP on your Fedora system, then install from php81 collection which is available in the remi-safe repository and can be installed with the command:

sudo dnf install php81

Additional PHP extensions can then be installed using the command:

sudo dnf install php81-php-xxx

To check the version of PHP 8.1 installed using this method, run:

$ php81 --version
PHP 8.1.14 (cli) (built: Jan  4 2023 06:45:14) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.14, Copyright (c), by Zend Technologies

Step 3:Install PHP 8.1 extensions on Fedora

Install PHP extensions using the name format php-<extension>. 

sudo dnf install php-<extension>

Here is an example to install mostly used extensions of PHP:

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

Step 4: Use PHP-FPM on Nginx / Apache httpd

The default PHP configuration file is /etc/php.ini.

sudo cat /etc/php.ini

For Nginx web server, use PHP-FPM (FastCGI Process Manager) configuration file to set CGI settings:

sudo vim /etc/php-fpm.d/www.conf

Once your PHP and PHP-FPM settings are modified, nginx and httpd web server services can be restarted.

# Nginx
sudo systemctl enable --now php-fpm
sudo systemctl restart nginx

# Apache
sudo systemctl enable --now php-fpm
sudo systemctl restart httpd

You should now have PHP 8.1 installed on Fedora Linux system. Enjoy PHP Development and have an amazing Code time.

Installation of PHP 8.1 on other systems:

Cart

Your Cart is Empty

Back To Shop