How to Install PHP 7.3 in CentOS 7

The CentOS 7 official software repositories have PHP 5.4 which has reached the end of life and no longer actively maintained by the developers.

To keep up with the latest features and security updates, you need a newer (probably the latest) version of PHP on your CentOS 7 system.

For the purpose of this guide, we will be operating the system as root, if that is not the case for you, make use of the sudo command to acquire root privileges.

Installing PHP 7 on CentOS 7

1. To install PHP 7, you have to install and enable EPEL and Remi repository on your CentOS 7 system with the commands below.

# yum install
# yum install

2. Next, you need to install yum-utils, a collection of useful programs for managing yum repositories and packages. It has tools that basically extend yum’s default features.

It can be used for managing (enabling or disabling) yum repositories as well as packages without any manual configuration and so much more.

# yum install yum-utils

3. One of the programs provided by yum-utils is yum-config-manager, which you can use to enable Remi repository as the default repository for installing different PHP versions as shown.

# yum-config-manager --enable remi-php70   [Install PHP 7.0]

If you want to install PHP 7.1, PHP 7.2 or PHP 7.3 on CentOS 7, just enable it as shown.

# yum-config-manager --enable remi-php71   [Install PHP 7.1]
# yum-config-manager --enable remi-php72   [Install PHP 7.2]
# yum-config-manager --enable remi-php73   [Install PHP 7.3]

4. Now install PHP 7 with all necessary modules with the command below.

# yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo 

Afterwards, double check the installed version of PHP on your system.

# php -v
Check PHP Version in CentOS 7

Check PHP Version in CentOS 7

Lastly, below is a list of useful PHP articles that you can read for additional information:

  1. How to Use and Execute PHP Codes in Linux Command Line
  2. How to Find MySQL, PHP and Apache Configuration Files
  3. How to Test PHP MySQL Database Connection Using Script
  4. How to Run PHP Script as Normal User with Cron

In this article, we have explained how to install PHP 7 on CentOS 7 Linux. You can send us any questions or additional thoughts via the feedback form below.

Best Affordable Linux and WordPress Services For Your Business
Outsource Your Linux and WordPress Project and Get it Promptly Completed Remotely and Delivered Online.

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

23 Responses

  1. Estellise says:

    When running command : yum-config-manager --enable remi-php70

    this results, is this okay?

    ================================= repo: remi-php72 ==================================
    async = True
    bandwidth = 0
    base_persistdir = /var/lib/yum/repos/x86_64/latest
    baseurl = 
    cache = 0
    cachedir = /var/cache/yum/x86_64/latest/remi-php72
    check_config_file_age = True
    compare_providers_priority = 80
    cost = 1000
    deltarpm_metadata_percentage = 100
    deltarpm_percentage = 
    enabled = True
    enablegroups = True
    exclude = 
    failovermethod = priority
    ftp_disable_epsv = False
    gpgcadir = /var/lib/yum/repos/x86_64/latest/remi-php72/gpgcadir
    gpgcakey = 
    gpgcheck = True
    gpgdir = /var/lib/yum/repos/x86_64/latest/remi-php72/gpgdir
    gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
    hdrdir = /var/cache/yum/x86_64/latest/remi-php72/headers
    http_caching = all
    includepkgs = 
    ip_resolve = 
    keepalive = True
    keepcache = False
    mddownloadpolicy = sqlite
    mdpolicy = group:small
    mediaid = 
    metadata_expire = 21600
    metadata_expire_filter = read-only:present
    metalink = 
    minrate = 0
    mirrorlist =
    mirrorlist_expire = 86400
    name = Remi's PHP 7.2 RPM repository for Enterprise Linux 7 - x86_64
    old_base_cache_dir = 
    password = 
    persistdir = /var/lib/yum/repos/x86_64/latest/remi-php72
    pkgdir = /var/cache/yum/x86_64/latest/remi-php72/packages
    priority = 99
    proxy = False
    proxy_dict = 
    proxy_password = 
    proxy_username = 
    repo_gpgcheck = False
    report_instanceid = False
    retries = 3
    skip_if_unavailable = False
    ssl_check_cert_permissions = True
    sslcacert = 
    sslclientcert = 
    sslclientkey = 
    sslverify = True
    throttle = 0
    timeout = 5.0
    ui_id = remi-php72
    ui_repoid_vars = releasever,
    username =
  2. Ganesh says:

    Hey, how to Remove the PHP installed by this tutorial, I used this tutorial to install PHP 7.2 and now I wanted to remove it, It Not showing in Package On in ->

    $ which php
    $ whereis php
    php: /usr/bin/php /usr/lib/php /usr/local/bin/php 

    What is the Solution ?

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.