Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Programming»PHP»How To Install PHP 7.4, 7.3 & 7.2 on CentOS/RHEL 7

    How To Install PHP 7.4, 7.3 & 7.2 on CentOS/RHEL 7

    By RahulJanuary 9, 20203 Mins Read

    PHP 7.4 is the latest stable release of PHP. May of popular yum repositories is providing rpm packages for PHP 7. This article is using Remi and EPEL yum repositories for installing the required packages on your system. This article will help you to install PHP 7.4, PHP 7.3, PHP 7.2, PHP 7.1 on CentOS & Redhat 7 servers. This tutorial has been tested with CentOS Linux release 7.4.1708.

    Advertisement
    • Install PHP7, Nginx and MySQL on CentOS/RedHat

    Setup Yum Repository

    First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems

    Use this command to install EPEL yum repository on your system

    sudo yum install epel-release
    

    and now execute one of the following commands as per your operating system version to install the Remi repository.

    sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
    

    Install PHP 7 on CentOS

    Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.4 or PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.

    ## Install PHP 7.4 
    yum --enablerepo=remi-php74 install php
    
    ## Install PHP 7.3 
    yum --enablerepo=remi-php73 install php
    
    ## Install PHP 7.2 
    yum --enablerepo=remi-php72 install php
    
    ## Install PHP 7.1 
    yum --enablerepo=remi-php71 install php
    

    I have installed the latest version PHP 7.4 on my system. Now running the following command to check the current active PHP version on my system.

    php -v
    
    PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
    

    Install PHP Modules

    You may also need to install additional PHP modules based on your application requirements. The below command will install some more useful PHP modules.

    ### For PHP 7.4
    yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
    
    ### For PHP 7.3
    yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
    
    ### For PHP 7.2
    yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
    
    ### For PHP 7.1
    yum --enablerepo=remi-php71 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
    

    You can run the following command to search other available PHP modules under configured yum repositories. Below example command search for all modules for PHP 7.4.

    yum --enablerepo=remi-php73 search php | grep php73
    
    
     * remi-php74: repo1.ash.innoscale.net
    php74.x86_64 : Package that installs PHP 7.4
    php74-php.x86_64 : PHP scripting language for creating dynamic web sites
    php74-php-bcmath.x86_64 : A module for PHP applications for using the bcmath
    php74-php-brotli.x86_64 : Brotli Extension for PHP
    php74-php-cli.x86_64 : Command-line interface for PHP
    php74-php-common.x86_64 : Common files for PHP
    php74-php-componere.x86_64 : Composing PHP classes at runtime
    php74-php-dba.x86_64 : A database abstraction layer module for PHP applications
    php74-php-dbg.x86_64 : The interactive PHP debugger
    php74-php-devel.x86_64 : Files needed for building PHP extensions
    php74-php-embedded.x86_64 : PHP library for embedding in applications
    php74-php-enchant.x86_64 : Enchant spelling extension for PHP applications
    php74-php-fpm.x86_64 : PHP FastCGI Process Manager
    php74-php-gd.x86_64 : A module for PHP applications for using the gd graphics
    php74-php-gmp.x86_64 : A module for PHP applications for using the GNU MP
    php74-php-imap.x86_64 : A module for PHP applications that use IMAP
    php74-php-intl.x86_64 : Internationalization extension for PHP applications
    php74-php-json.x86_64 : JavaScript Object Notation extension for PHP
    ...
    ...
    

    CentOS 7 PHP PHP 7.1 PHP 7.2 PHP 7.4 PHP7
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Installing PHP on Pop!_OS

    How to Install PHP 8.x on Pop!_OS

    Managing Dependencies with Composer: A Beginner’s Guide

    10 Simple Ways to Speed Up Your WordPress Website

    10 Simple Ways to Speed Up Your WordPress Website

    View 17 Comments

    17 Comments

    1. Noman on August 19, 2022 2:22 am

      How about installing php modules without internet?

      Reply
    2. charles on March 1, 2021 9:54 am

      Thank you so much

      Reply
    3. Remi on September 7, 2020 5:35 am

      Probably better to follow official wizard instructions, see https://rpms.remirepo.net/wizard/

      EL-7 way (1 repo per version) being very different than EL-8 way (1 stream per version).

      And for question about my repository to use official forum.

      Reply
    4. Naqash on July 17, 2020 7:29 am

      # yum –enablerepo=remi-php73 install php
      DigitalOcean Agent 119 kB/s | 3.3 kB 00:00
      Package php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 is already installed.
      Dependencies resolved.
      Nothing to do.
      Complete!

      i am unable to update my php. i dont know what is wrong. Even if i use php74 repo, it still says
      “”php-7.2.24-1.module_el8.2.0+313+b04d0a66.x86_64 is already installed.
      Dependencies resolved.
      Nothing to do.””

      what am i doing wrong ?

      Reply
    5. Tam on July 15, 2020 12:51 am

      I lleave a response whenever I appreciate a pot on a site
      or if I have something to contribute to the discussion. Usually it is caused
      by the fire communicated in the post I read. And after this post How To Install PHP 7.4, 7.3 & 7.2 on CentOS 7 – TecAdmin. I was moved eenough to drop a thought 🙂 I do have 2 questions foor you if it’s
      allright. Is it simply me or does it give the imprewsion like some of the comments appear aas if they are written by brain dead folks?
      😛 And, if you are wrjting on additional places, I would like to keep up with you.
      Would you list the complete urls of your sbared ssites like your linkedin profile,
      Facebook page orr twitter feed?

      Reply
    6. DANIEL MARQUES CUNHA on January 6, 2020 2:50 pm

      Thank you man, I needed to do that using the ansible and this article helped me to have some ideas of how to do it.

      Reply
    7. Elijah on August 25, 2019 5:05 pm

      Thank you so much! This is the best guide on the Internet. Now I have PHP 7.3 and it works more than fine.

      Reply
    8. Anjum Yaseen on August 15, 2019 1:41 pm

      Hi,

      I successfully installed php7.2 on my RHEL7. Now I need to install zend modules, does anyone knows how to do that? Baiscally l want following:

      Thanks

      [[email protected] ~]# php -v
      PHP 5.3.14 (cli) (built: Dec 10 2013 10:53:17)
      Copyright (c) 1997-2012 The PHP Group
      Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
      with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies
      – with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
      – with Zend Download Server v1.5.0, Copyright (c) 1998-2010 Zend Technologies Ltd., by Zend Technologies [loaded] [licensed] [disabled]
      – with Zend Job Queue v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [not licensed] [disabled]
      – with Zend Session Clustering v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
      – with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled]
      – with Zend Optimizer+ v4.1, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [disabled]
      – with Zend Code Tracing v1.0, Copyright (c) 2009-2010, by Zend Technologies [loaded] [not licensed] [disabled]
      – with Zend Page Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]

      Reply
    9. Serguei Kireev on July 17, 2019 1:39 am

      good one, keep returning to it..

      Reply
    10. Steven Gallagher on April 17, 2019 8:32 am

      Amazing, thank you!

      Reply
    11. Chris on March 6, 2019 11:12 pm

      This was very helpful, thank you!

      Reply
    12. FIxrunner on February 1, 2019 7:52 pm

      Retrieving http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
      warning: /var/tmp/rpm-tmp.YsDcyD: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
      error: Failed dependencies:
      epel-release = 7 is needed by remi-release-7.6-1.el7.remi.noarch

      Reply
      • Swati on June 14, 2019 8:28 am

        I think you must have figured out solution already but just in case anybody needs solution. I had same error and it was due to Centos6.
        Use this yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm #CentOS/RHEL 6 instead of
        http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

        Hope this helps , thanks!

        Reply
    13. Pablo on January 15, 2019 8:14 am

      Hi, first of all, thanks for your post. I’ve tried to update to php 7.3 but there is an error with the packet libargon2.so.0()(64bit). After a research on the Internet, it seems there are some packets not uptated yet for CentOS: https://blog.remirepo.net/pages/PECL-extensions-RPM-status
      So I don’t know if there is a way to full update to PHP 7.3 with no errors. THX!!

      Error: Paquete: php-7.3.1-1.el7.remi.x86_64 (remi-php73)
      Necesita: libargon2.so.0()(64bit)
      Error: Paquete: php-cli-7.3.1-1.el7.remi.x86_64 (remi-php73)
      Necesita: libargon2.so.0()(64bit)
      Error: Paquete: php-fpm-7.3.1-1.el7.remi.x86_64 (remi-php73)
      Necesita: libargon2.so.0()(64bit)

      Reply
    14. Андрей on January 26, 2018 3:52 am

      Спасибо, друг!

      Reply
    15. Charles on December 17, 2015 10:33 pm

      I have PHP 5.4 , PHP 5.5, PHP, 5.6 installed and need to leave them installed. When I try to install php70w I get the error, “php70w-common-7.0.0-1.w7.x86_64 conflicts php-common < 5.5.0". Do your directions only work if we uninstall previous versions of PHP? If so, what should I do to make it work where multiple versions of PHP need to be installed?

      Reply
      • Praveen Dewangan on January 12, 2018 9:27 am

        Hi Charles,

        You can manage multiple PHP versions using PHPBrew. It is also useful to switch between different versions of PHP.

        Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Test Your Internet Speed from the Linux Terminal
    • 11 Practical Example of cat Command in Linux
    • sleep Command in Linux with Examples
    • 20 Basic Linux Commands for the Beginners (Recommended)
    • tail Command in Linux with Examples
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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