Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Programming»PHP»How to Install PHP 7.4, 7.3 & 7.2 on CentOS 8

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

    RahulBy RahulNovember 17, 20192 Mins ReadUpdated: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
    
    CentOS 8 PHP PHP 7
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install and Use Multiple Node.JS on Linux
    Next Article How to ignore git file permission changes

    Related Posts

    How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04

    Updated:May 9, 20223 Mins Read

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How To Install LAMP Stack on Ubuntu 22.04 LTS

    Updated:April 20, 20225 Mins Read

    How To Setup Apache, PHP & MongoDB in Ubuntu & Debian

    Updated:October 8, 20213 Mins Read

    How To Install and Use PHP Composer on Debian 11

    Updated:February 16, 20224 Mins Read

    How To Install PHP (8.1, 7.4 & 5.6) on Debian 11

    Updated:February 16, 20224 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.