• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install PHP 7.4, 7.3 & 7.2 on CentOS 8

Written by Rahul, Updated on July 24, 2020

CentOS 8 is the latest release available for CentOS operating system. Our previous tutorial has the instructions for the installation of Apache on CentOS 8. This tutorial will help you to install PHP 7 on CentOS 8 and RHEL 8 Linux systems. PHP 7.4 is the latest stable version available for the installation.

Setup Yum Repository

For this tutorial, we will use the REMI repository for PHP installation on CentOS 8 Linux system. So add the REMI repository on your system using the following command.

sudo dnf install dnf-utils http://rpms.remirepo.net/enterprise/remi-release-8.rpm

REMI repository contains the PHP packages. You just need to enable the correct repo for the required PHP version. Find out the available repository for the different PHP versions.

sudo dnf module list php

Last metadata expiration check: 0:33:48 ago on Wed 23 Nov 2019 08:12:31 PM PST.
CentOS-8 - AppStream
Name      Stream             Profiles                          Summary
php       7.2 [d]            common [d], devel, minimal        PHP scripting language

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name      Stream             Profiles                          Summary
php       remi-7.2           common [d], devel, minimal        PHP scripting language
php       remi-7.3 [e]       common [d] [i], devel, minimal    PHP scripting language
php       remi-7.4           common [d], devel, minimal        PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

The above output shows that the default AppStream contains PHP 7.2 and REMI contains PHP 7.2, 7.3 and 7.4 packages. Let’s start with the PHP installation.

Install PHP on CentOS 8

At this point, your system is ready for PHP installation. PHP 7.4 is the latest stable release available for the installation. So you can use the latest version for the production servers. You can use other PHP versions as per your requirements.

Install PHP 7.4

sudo dnf module reset php
sudo dnf module enable php:remi-7.4
sudo dnf install php

Install PHP 7.3

sudo dnf module reset php
sudo dnf module enable php:remi-7.3
sudo dnf install php

Install PHP 7.2

sudo dnf module reset php
sudo dnf module enable php:remi-7.2
sudo dnf install php

Install PHP Modules

You may also require additional PHP modules to run your PHP application.

sudo dnf install php-gd php-mysqlnd php-soap

Test PHP Version

After successful installation use the following command to test the installed PHP version.

php -v

PHP 7.4.8 (cli) (built: Jul  9 2020 08:57:23) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy