Welcome to our guide on how to Install PHP 7.3 on RHEL 8 / CentOS 8 Linux. PHP 7.3 was recently released with plenty of new features, bug fixes, performance improvement, deprecations as well as new functionalities. You can read more on the PHP ChangeLog page.

For installation of PHP 7.3 on other operating systems, use below guides:

How to Install PHP 7.3 on Arch Linux and Manjaro

How to Install PHP 7.3 on Debian 9 / Debian 8

How to install PHP 7.3 on Ubuntu 18.04 / Ubuntu 16.04 / Debian

How to Install PHP 7.3 on CentOS 7 / Fedora

How to install PHP 7.3 / PHP 7.3-FPM on Linux Mint 19

Install PHP 7.3 on RHEL 8 / CentOS 8 Linux

Update your RHEL 8 system.

sudo dnf -y update

Add Remi and EPEL repository to RHEL 8:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm

Remi stream for PHP 7.3 and PHP 7.2 should be dded to your RHEL 8 system.

$ sudo dnf module list | grep php
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                                             
php                  7.2         common [d], devel, minimal               PHP scripting language 

Enable Remi repository for PHP 7.3 on CentOS 8 / RHEL 8:

sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --set-enabled remi-php73
sudo dnf config-manager --set-enabled remi

Then install PHP and the extensions you want to use.

sudo dnf module install php:remi-7.3
sudo dnf update

Accept installation when promted:

Dependencies resolved.
===================================================================================================================================================
 Package                    Arch             Version                                              Repository                                  Size
===================================================================================================================================================
Installing group/module packages:
 php-cli                    x86_64           7.3.9-1.el8.remi                                     remi-modular                               4.6 M
 php-common                 x86_64           7.3.9-1.el8.remi                                     remi-modular                               1.1 M
 php-fpm                    x86_64           7.3.9-1.el8.remi                                     remi-modular                               1.6 M
 php-json                   x86_64           7.3.9-1.el8.remi                                     remi-modular                                71 k
 php-mbstring               x86_64           7.3.9-1.el8.remi                                     remi-modular                               520 k
 php-xml                    x86_64           7.3.9-1.el8.remi                                     remi-modular                               229 k
Installing dependencies:
 libargon2                  x86_64           20171227-3.el8                                       epel                                        29 k
 oniguruma                  x86_64           6.8.2-1.el8                                          rhel-8-for-x86_64-appstream-rpms           188 k
 httpd-filesystem           noarch           2.4.37-11.module+el8.0.0+2969+90015743               rhel-8-for-x86_64-appstream-rpms            34 k
 nginx-filesystem           noarch           1:1.14.1-9.module+el8.0.0+4108+af250afe              rhel-8-for-x86_64-appstream-rpms            24 k
 libxslt                    x86_64           1.1.32-3.el8                                         rhel-8-for-x86_64-baseos-rpms              249 k
Installing module profiles:
 php/common                                                                                                                                       
Enabling module streams:
 httpd                                       2.4                                                                                                  
 nginx                                       1.14                                                                                                 
 php                                         remi-7.3                                                                                             

Transaction Summary
===================================================================================================================================================
Install  11 Packages

Total download size: 8.6 M
Installed size: 36 M
Is this ok [y/N]: y

You should now have PHP 7.3 installed on RHEL 8 / CentOS 8. Confirm PHP version.

$ php -v
PHP 7.3.9 (cli) (built: Aug 27 2019 22:52:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies

To install other extensions, use the name format php-<extension>. The example below will install standard PHP extensions.

sudo dnf install php-fpm php-mysqlnd php-zip php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json

The default PHP configuration file is /etc/php.ini . For Nginx web server, use PHP-FPM (FastCGI Process Manager) configuration file to set CGI settings /etc/php-fpm.d/www.conf

Start php-fpm service:

sudo systemctl enable --now php-fpm

When PHP settings are modified, you may need to restart your Web server.

sudo systemctl restart nginx
OR
sudo systemctl restart httpd

Test PHP 7.3 on CentOS 8 / RHEL 8

To test our installation, install httpd.

sudo dnf module install -y httpd

Active httpd and php-fpm services:

sudo systemctl enable --now php-fpm httpd

Add phph test page:

echo '<?php phpinfo();' | sudo tee /var/www/html/info.php

Browse to your server IP on http://localhost/info.php to see php in action.

Enjoy using PHP 7.3 on CentOS 8 / RHEL 8. For installation and usage of PHP 7.2/7.1, refer to:

How to Install PHP 7.2 ,7.1 on RHEL / CentOS 8

Tags:

  • How to Install PHP 7.3 on RHEL 8 / CentOS 8
  • How to Install PHP 7.3-FPM on RHEL 8 / CentOS 8
  • How To Install PHP on CentOS / RHEL 8
  • PHP 7.3 installation on CentOS 8 / RHEL 8