Menu
User

DropVPS Team

Writer: John hens

How install php 8.1 on centos 8

How install php 8.1 on centos 8

Publication Date

09/17/2025

Category

Articles

Reading Time

2 Min

Table of Contents

PHP is a powerful scripting language widely used for web development. If you are runningCentOS 8, you can easily install PHP using the system’s package manager

Step 1: Update Your System

It is always a good practice to update your CentOS system before installing new software. This ensures you have the latest security patches and package versions:

sudo dnf update -y

Step 2: Enable EPEL and Remi Repositories

CentOS 8 does not include the latest PHP versions in its default repository. To access updated versions, you need to enable EPEL (Extra Packages for Enterprise Linux) and the Remi repository:

sudo dnf install -y epel-release
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Step 3: Enable the Desired PHP Module

CentOS 8 uses AppStream modules for managing software versions. You need to reset the existing PHP module and enable the version you want, for example PHP 8.1:

sudo dnf module reset php -y
sudo dnf module enable php:remi-8.1 -y

Step 4: Install PHP and Common Extensions

Now install PHP along with the most common extensions that many applications require:

sudo dnf install -y php php-cli php-fpm php-mysqlnd php-zip php-json php-gd php-mbstring php-curl php-xml

This will provide full PHP functionality for web applications and frameworks.

Step 5: Verify PHP Installation

After the installation completes, confirm that PHP is installed and check the version:

php -v

You should see the installed PHP version details displayed in the terminal.

Linux VPS
U
Loading...

Related Posts