Install PHP 7.3 / PHP 7.3-FPM on RHEL 8 | CentOS 8

Posted on 166 views

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:

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
hp                  7.2 [d]           common [d], devel, minimal               PHP scripting language
php                  7.3              common [d], devel, minimal               PHP scripting language
php                  7.4              common [d], devel, minimal               PHP scripting language
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 [e]     common [d] [i], devel, minimal           PHP scripting language
php                  remi-8.0         common [d], devel, minimal               PHP scripting language
php                  remi-8.1         common [d], devel, minimal               PHP scripting language

Disable default PHP module.

sudo dnf -y install dnf-plugins-core
sudo dnf module -y reset php

Then install PHP 7.3 on CentOS 8 / RHEL 8 and the extensions that comes bundled with it.

sudo dnf module install php:remi-7.3

Accept installation when promted:

Dependencies resolved.
================================================================================================================================================================================================
 Package                                      Architecture                           Version                                                 Repository                                    Size
================================================================================================================================================================================================
Installing dependencies:
 libargon2                                    x86_64                                 20171227-3.el8                                          epel                                          29 k
Downgrading:
 php-bcmath                                   x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                  83 k
 php-cli                                      x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 4.6 M
 php-common                                   x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 1.1 M
 php-fpm                                      x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 1.6 M
 php-gd                                       x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                  92 k
 php-imap                                     x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 100 k
 php-intl                                     x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 243 k
 php-json                                     x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                  76 k
 php-mbstring                                 x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 524 k
 php-mysqlnd                                  x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 256 k
 php-pdo                                      x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 142 k
 php-pecl-zip                                 x86_64                                 1.20.1-1.el8.remi.7.3                                   remi-modular                                  68 k
 php-process                                  x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                  97 k
 php-xml                                      x86_64                                 7.3.33-1.el8.remi                                       remi-modular                                 232 k
Installing module profiles:
 php/common
Enabling module streams:
 php                                                                                 remi-7.3

Transaction Summary
================================================================================================================================================================================================
Install     1 Package
Downgrade  14 Packages

Total download size: 9.2 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.33 (cli) (built: Nov 16 2021 11:18:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies

To install other extensions, use the name format php-. 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.

# Nginx
sudo systemctl restart nginx

# Apache web server
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 '

Open http Port on your firewall

sudo firewall-cmd --add-service=http,https --permanent
sudo firewall-cmd --reload

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

php-7-centos-rhel-rocky-1024x868

Enjoy using PHP 7.3 on CentOS 8 / RHEL 8.

coffee

Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.