How to Install PHP using Remi Repository on CentOS

PHP is a widely-used open-source scripting language primarily employed for server-side web development. As new PHP versions are released, they introduce improved performance, security enhancements, and new features that can benefit web applications. In CentOS, RHEL, and Fedora systems, the default repositories usually offer older, stable versions of PHP. To access the latest PHP versions and additional software packages not available in the default repositories, you can utilize the Remi repository.

The Remi repository is a popular third-party repository maintained by Remi Collet. It provides up-to-date versions of PHP, MySQL, and other software packages for CentOS, RHEL, and Fedora systems. By using the Remi repository, you can ensure that your system runs the latest PHP version, making it possible to leverage the most recent features and optimizations while maintaining compatibility with newer web frameworks and libraries.

In this guide, we will demonstrate how to install PHP using the Remi repository on CentOS. We will cover the steps to set up the necessary repositories, enable the desired PHP version, install PHP and additional modules, and verify the PHP installation. This process will enable you to work with the latest PHP versions and take advantage of the benefits they offer for your web development projects.

See also  How to Fix "Warning: RPMDB altered outside of yum" Error

Step 1: Install EPEL and Remi repositories

Before installing PHP, you need to set up the EPEL and Remi repositories on your CentOS system. To install the EPEL repository, run:

sudo yum install -y epel-release

To install the Remi repository, execute the following commands:

sudo yum install -y

Replace “7” with your CentOS version if you are not using CentOS 7.

Step 2: Enable the desired Remi repository

The Remi repository provides several PHP versions, so you need to enable the repository for the specific PHP version you want to install. To list available PHP versions, use the yum-config-manager command:

sudo yum install -y yum-utils
sudo yum-config-manager --list-enabled | grep remi

To enable the repository for PHP 7.4, for example, execute:

sudo yum-config-manager --enable remi-php74

Replace “74” with the desired PHP version, such as “73” for PHP 7.3 or “80” for PHP 8.0.

See also  How to Install wget on Linux (Ubuntu, CentOS, RHEL, Fedora)

Step 3: Install PHP

With the desired Remi repository enabled, you can now install PHP using the yum command:

sudo yum install -y php

This command installs the base PHP package along with some common PHP modules. To install additional PHP modules, use the following command, replacing “module_name” with the desired module:

sudo yum install -y php-module_name

Step 4: Verify PHP installation

To verify the PHP installation, run the following command:

php -v

This command displays the installed PHP version and some additional information.

Programs Mentioned:

  • EPEL repository – Extra Packages for Enterprise Linux (EPEL) is a Fedora Special Interest Group that provides high-quality add-on packages for Linux distributions, including CentOS and RHEL, that are not available in the default repositories.
  • Remi repository – A third-party repository for CentOS, RHEL, and Fedora systems that offers updated and additional packages, maintained by Remi Collet.
  • yum – The default package manager for CentOS and RHEL, used to install, update, and manage software packages on the system.
  • PHP – A popular open-source scripting language widely used for web development.
See also  How to install and use pip for Python 3 on Ubuntu


Awesome! You have successfully installed PHP on your CentOS system using the Remi repository. This enables you to work with up-to-date PHP versions and take advantage of the latest features and improvements. Keep in mind that using third-party repositories may introduce compatibility issues or conflicts with the official repositories, so exercise caution when installing packages from these sources.

If you have any questions, comments, or suggestions for improvements, please feel free to share your thoughts. Your feedback helps us provide the most accurate and useful information possible.


Leave a Reply

Your email address will not be published. Required fields are marked *