How to Install PHP 8.2 in CentOS 8 Stream

PHP is a script language and interpreter that is freely available and used primarily on Linux Web servers.

To install PHP 8.2, we’ll need to add/enable the Remi RPM repositories which contain the PHP 8.2 packages that we need.

Pre-requisites :

  • A system with CentOS 8 Stream installed and running.

  • root access to the system.

Installing the EPEL and Remi Repository

For this, we use the PHP 8.2 packaged by Remi,

First, let us install the EPEL repository,

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

Next, install the Remi repository with the following command,

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

Output:

[root@vps ~]# dnf module install php:remi-8.2
Last metadata expiration check: 0:00:42 ago on Tue 20 Dec 2022 03:08:14 AM UTC.
Dependencies resolved.
=========================================================================================================================================
 Package                       Architecture        Version                                               Repository                 Size
=========================================================================================================================================
Installing group/module packages:
 php-cli                       x86_64              8.2.0-1.el8.remi                                      remi-modular              5.4 M
 php-common                    x86_64              8.2.0-1.el8.remi                                      remi-modular              1.3 M
 php-fpm                       x86_64              8.2.0-1.el8.remi                                      remi-modular              1.9 M
 php-mbstring                  x86_64              8.2.0-1.el8.remi                                      remi-modular              574 k
 php-xml                       x86_64              8.2.0-1.el8.remi                                      remi-modular              254 k
Installing dependencies:
 httpd-filesystem              noarch              2.4.37-47.module_el8.6.0+1111+ce6f4ceb.1              appstream                  41 k
 libxslt                       x86_64              1.1.32-6.el8                                          baseos                    250 k
 oniguruma5php                 x86_64              6.9.8-1.el8.remi                                      remi-safe                 212 k
Installing weak dependencies:
 nginx-filesystem              noarch              1:1.14.1-9.module_el8.0.0+1060+3ab382d3               appstream                  24 k
Installing module profiles:
 php/common
Enabling module streams:
 httpd                                             2.4
 nginx                                             1.14
 php                                               remi-8.2

Transaction Summary
=========================================================================================================================================
Install  9 Packages

Total download size: 9.9 M
Installed size: 45 M
Is this ok [y/N]: y

To install yum utilities.

dnf -y install yum-utils

To enable php 8.2 Remi repository.

dnf module reset php

dnf module enable php:remi-8.2

Output:

[root@vps ~]# dnf module enable php:remi-8.2
Last metadata expiration check: 0:03:10 ago on Tue 13 Dec 2022 05:29:26 AM UTC.
Dependencies resolved.
=======================================================================================================================================
 Package                     Architecture      Version                                                   Repository               Size
=======================================================================================================================================
Installing group/module packages:
 php-cli                     x86_64            8.2.0-1.el8.remi                                          remi-modular            5.4 M
 php-common                  x86_64            8.2.0-1.el8.remi                                          remi-modular            1.3 M
 php-fpm                     x86_64            8.2.0-1.el8.remi                                          remi-modular            1.9 M
 php-mbstring                x86_64            8.2.0-1.el8.remi                                          remi-modular            574 k
 php-xml                     x86_64            8.2.0-1.el8.remi                                          remi-modular            254 k
Installing dependencies:
 httpd-filesystem            noarch            2.4.37-51.module_el8.7.0+3281+01e58653                    appstream                41 k
 libxslt                     x86_64            1.1.32-6.el8                                              baseos                  248 k
 oniguruma5php               x86_64            6.9.8-1.el8.remi                                          remi-safe               212 k
Installing weak dependencies:
 nginx-filesystem            noarch            1:1.14.1-9.module_el8.3.0+2165+af250afe.alma              appstream                23 k
Installing module profiles:
 php/common
Enabling module streams:
 httpd                                         2.4
 nginx                                         1.14
 php                                           remi-8.2

Transaction Summary
=======================================================================================================================================
Install  9 Packages

Total download size: 9.9 M
Installed size: 45 M
Is this ok [y/N]: y

To install any remaining updates.

dnf update

Install PHP 8.2

To install PHP.

dnf install php

Output:

[root@vps ~]# dnf install php
Last metadata expiration check: 0:15:05 ago on Sat 01 Jul 2023 06:57:31 PM UTC.
Dependencies resolved.
=============================================================================================================================================================
 Package                                  Architecture                   Version                                  Repository                            Size
=============================================================================================================================================================
Installing:
 php                                      x86_64                         8.2.7-2.el9.remi                         remimodular                         1.8 M
Installing dependencies:
 apr                                      x86_64                         1.7.0-11.el9                             appstream                            123 k
 apr-util                                 x86_64                         1.6.1-20.el9                             appstream                             95 k
 apr-util-bdb                             x86_64                         1.6.1-20.el9                             appstream                             14 k
 httpd-core                               x86_64                         2.4.57-2.el9                             appstream                            1.5 M
 httpd-filesystem                         noarch                         2.4.57-2.el9                             appstream                             15 k
 httpd-tools                              x86_64                         2.4.57-2.el9                             appstream                             84 k
 libsodium                                x86_64                         1.0.18-8.el9                             epel                                 161 k
 libxslt                                  x86_64                         1.1.34-9.el9                             appstream                            243 k
 mailcap                                  noarch                         2.1.49-5.el9                             baseos                                33 k
oniguruma5php                            x86_64                         6.9.8-1.el9.remi                         remi-safe   219 k
 php-common                               x86_64                         8.2.7-2.el9.remi                         remimodular                         838 k
Installing weak dependencies:
 apr-util-openssl                         x86_64                         1.6.1-20.el9                             appstream                             16 k
 nginx-filesystem                         noarch                         1:1.22.1-2.el9                           appstream                             12 k
 php-cli                                  x86_64                         8.2.7-2.el9.remi                         remimodular                         5.3 M
 php-fpm                                  x86_64                         8.2.7-2.el9.remi                         remimodular                         1.8 M
 php-mbstring                             x86_64                         8.2.7-2.el9.remi                         remi-modular                         574 k
 php-opcache                              x86_64                         8.2.7-2.el9.remi                         remi-modular                         601 k
 php-pdo                                  x86_64                         8.2.7-2.el9.remi                         remi-modular                         117 k
 php-sodium                               x86_64                         8.2.7-2.el9.remi                         remi-modular                          62 k
 php-xml                                  x86_64                         8.2.7-2.el9.remi                         remi-modular                         203 k

Transaction Summary
=============================================================================================================================================================
Install  21 Packages

Total download size: 14 M
Installed size: 67 M
Is this ok [y/N]: Y
Downloading Packages:
(1/21): mailcap-2.1.49-5.el9.noarch.rpm                                                                                       74 kB/s |  33 kB     00:00
(2/21): apr-util-1.6.1-20.el9.x86_64.rpm                                                                                     210 kB/s |  95 kB     00:00
(3/21): apr-1.7.0-11.el9.x86_64.rpm                                                                                          185 kB/s | 123 kB     00:00
(4/21): apr-util-bdb-1.6.1-20.el9.x86_64.rpm                                                                                  54 kB/s |  14 kB     00:00
(5/21): apr-util-openssl-1.6.1-20.el9.x86_64.rpm                                                                              41 kB/s |  16 kB     00:00 
(6/21): httpd-filesystem-2.4.57-2.el9.noarch.rpm                                                                              35 kB/s |  15 kB     00:00
(7/21): httpd-tools-2.4.57-2.el9.x86_64.rpm                                                                                  199 kB/s |  84 kB     00:00
(8/2
Complete!

NOTE: It will prompt for permission type y and press Enter to proceed with the installation.

To check PHP Version.

php -v

Output:

[root@vps ~]# php -v
PHP 8.2.0 (cli) (built: Dec  6 2022 14:26:47) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.0, Copyright (c) Zend Technologies
        with Zend OPcache v8.2.0, Copyright (c), by Zend Technologies

This concludes our topic of installing PHP 8.2 on CentOS 8 Stream the system.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS