How To Install PHP 7.4 on Fedora 37
In this tutorial, we will show you how to install PHP 7.4 on Fedora 37. For those of you who didn’t know, PHP is a programming language that is widely used for web development. PHP 7.4 is the latest version of PHP, which was released in November 2020. Some of the key features of PHP 7.4 include typed properties, arrow functions, and preloading. Typed properties allow developers to specify the type of a class property, which can help improve code reliability and make it easier to catch type errors. Arrow functions, which are also known as lambda functions, allow developers to write short, anonymous functions more easily. Preloading is a performance optimization that can help speed up PHP applications by loading certain components into memory at the start of a request, so they don’t need to be loaded again later.
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 7.4 on a Fedora 37.
- A server running one of the following operating systems: Fedora 37.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
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 7.4 on Fedora 37
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
Step 2. Add Remi PHP Repository.
We need to import the REMI PHP repository to install the PHP 7.4 version and keep it up-to-date:
sudo dnf install http://rpms.remirepo.net/fedora/remi-release-37.rpm
Verify the installation:
dnf repolist | grep remi
[email@example.com ~]$ dnf repolist | grep remi remi Remi's RPM repository - Fedora 37 - x86_64 remi-modular Remi's Modular repository - Fedora 37 - x86_64
Step 3. Installing PHP 7.4 on Fedora 37.
By default, the PHP package come in the default repository of Fedora 37. Now run the following command below to install the PHP 87.4 packages to your Fedora system:
sudo dnf module enable php:remi-7.4 sudo dnf install php-cli php-fpm php-curl php-mysqlnd php-gd php-opcache php-zip php-intl php-common php-bcmath php-imagick php-xmlrpc php-json php-readline php-memcached php-redis php-mbstring php-apcu php-xml php-dom php-redis php-memcached php-memcache
Confirm the current PHP version installed:
[firstname.lastname@example.org ~]$ php -v PHP 7.4.33 (cli) (built: Dec 05 2022 10:46:11) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies
Congratulations! You have successfully installed PHP. Thanks for using this tutorial for installing PHP 7.4 on your Fedora 37 system. For additional help or useful information, we recommend you check the official PHP website.