How to Install PHP 7.3 in centOS 8

Add Remi Repository:

Remi, a third-party repository which offers multiple versions of PHP (7.4 / 7.3 / 7.2)

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Install the Remi repository by using the below command

yum install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Output:

[root@my ~]# yum install -y https://rpms.remirepo.net/enterprise/remi-release-8.                                                                                        rpm
Extra Packages for Enterprise Linux 8 - x86_64  954 kB/s | 3.4 MB     00:03
Last metadata expiration check: 0:00:01 ago on Sat 16 Nov 2019 02:47:09 PM EST.
remi-release-8.rpm                               18 kB/s |  20 kB     00:01
Dependencies resolved.
================================================================================
    Package            Arch         Version               Repository          Size
================================================================================
Installing:
    remi-release       noarch       8.0-4.el8.remi        @commandline        20 k

Transaction Summary
================================================================================
Install  1 Package

List the available PHP module stream:

To check list the available PHP module by using following command

yum module list php

Output:

[root@my ~]# yum module list php
Remi's Modular repository for Enterprise Linux  155 kB/s | 509 kB     00:03
Safe Remi's RPM repository for Enterprise Linux 1.0 MB/s | 1.4 MB     00:01
CentOS-8 - AppStream
Name     Stream         Profiles                       Summary
php      7.2 [d][e]     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       common [d], 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
[root@my ~]#

Enable php:remi-7.3 module to install PHP 7.3:

yum module enable php:remi-7.3 -y

Output:

[root@my ~]# yum module enable php:remi-7.3 -y
Last metadata expiration check: 0:04:16 ago on Sat 16 Nov 2019 02:49:58 PM EST.
Dependencies resolved.
================================================================================
    Package           Arch             Version             Repository         Size
================================================================================
Enabling module streams:
    php                                remi-7.3

Transaction Summary
================================================================================
Complete!

Install PHP 7.3:

yum install -y php php-cli php-common

Check PHP Version:

Once you have installed PHP, check the PHP version

php -v

Output:

[root@my ~]# php -v
PHP 7.3.11 (cli) (built: Oct 22 2019 08:11:04) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
                with Zend OPcache v7.3.11, Copyright (c) 1999-2018, by Zend Technologies
[root@my ~]#

Install PHP-FPM:

If you are setting up LEMP stack on centos 8, you might want to install php-fpm 7.3

yum install -y php-fpm

Once you have installed PHP-FPM, check the PHP-FPM version

php-fpm -v

Output:

[root@my ~]# php-fpm -v
PHP 7.3.11 (fpm-fcgi) (built: Oct 22 2019 08:11:04)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.11, Copyright (c) 1999-2018, by Zend Technologies
[root@my ~]#