How To Install PHP 8.1 “PHP-FPM” on CentOS Stream 8

DigitalOcean Referral Badge
Start your VPS now with FREE $100 credit.

PHP 8.1 is a current latest stable release of PHP branch which active support until 25 November 2023 and still getting security patches for the next 2 years, 5 months. It’s highly-recommended to running web-based applications, either it website or blog with the latest stable PHP branch to avoid security issues. You can also gets benefits with the new features which usually available in the latest stable release of PHP version.

Well, in today’s guide we will teach you on this tutorial on how to install PHP 8.1 “PHP-FPM” on CentOS Stream 8. We will run PHP 8.1 with a FastCGI Process Manager a.k.a PHP-FPM to run simple web apps. FPM is an advanced PHP FastCGI implementation which should be used on the heavy-loaded production environments. It more advanced, robust and modern compared to the traditional Apache PHP modules as the PHP handlers like mod_php, mod_cgi, or mod_dso which requires more server resources, altough it used to run the same web applications.

Later we will combines OpenResty web-platform with PHP8.1-FPM and MariaDB 10.6 database server to run a simple website with a WordPress CMS. However, make sure to meet the following pre-requisites before moving to the installation guide.


* VPS, Cloud or Bare-Metal Servers
* OS Distro CentOS Stream 8
* Superuser Privileges (Root Access)
* Familiar with CLI-Based or Command-Line Only
* Gnome Terminal for Linux Desktop
* PuTTy SSH Client for Windows or Mac
* Powershell for Windows 10/11
* Familiar with DNF-Based Commands

1.) Login as Root on SSH Console

On this guide we will use my cheap $5 Cloud VPS which deployed on Digital Ocean droplet and set it to run under CentOS Stream 8 distro.

$ ssh [email protected] -p22
[email protected]'s password:

2.) Run System Update

On the newly deployed VPS, don’t forget to run system update in order to get the latest available, Linux Kernel, softwares or packages along with its dependencies.

$ dnf update
Last metadata expiration check: 0:00:12 ago on Wed 01 Jun 2022 11:40:06 AM UTC.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Dependencies resolved.
Package Architecture Version Repository Size
kernel x86_64 4.18.0-383.el8 baseos 8.1 M
kernel-core x86_64 4.18.0-383.el8 baseos 39 M
kernel-modules x86_64 4.18.0-383.el8 baseos 32 M
NetworkManager x86_64 1:1.39.5-1.el8 baseos 2.2 M
NetworkManager-libnm x86_64 1:1.39.5-1.el8 baseos 1.9 M
NetworkManager-team x86_64 1:1.39.5-1.el8 baseos 154 k
NetworkManager-tui x86_64 1:1.39.5-1.el8 baseos 347 k
audit x86_64 3.0.7-4.el8 baseos 263 k
audit-libs x86_64 3.0.7-4.el8 baseos 123 k
authselect x86_64 1.2.2-3.el8 baseos 133 k
authselect-compat x86_64 1.2.2-3.el8 appstream 38 k
authselect-libs x86_64 1.2.2-3.el8 baseos 222 k
bash x86_64 4.4.20-4.el8 baseos 1.5 M
bind-export-libs x86_64 32:9.11.36-3.el8 baseos 1.1 M
c-ares x86_64 1.13.0-6.el8 baseos 93 k
cairo x86_64 1.15.12-6.el8 appstream 719 k
cairo-gobject x86_64 1.15.12-6.el8 appstream 33 k
centos-gpg-keys noarch 1:8-6.el8 baseos 14 k
centos-logos x86_64 85.8-2.el8 appstream 700 k
centos-stream-repos noarch 8-6.el8 baseos 20 k
chkconfig x86_64 1.19.1-1.el8 baseos 198 k
chrony x86_64 4.1-1.el8 baseos 327 k
cloud-init noarch 22.1-1.el8 appstream 1.2 M
cloud-utils-growpart noarch 0.31-3.el8 appstream 32 k
cockpit-bridge x86_64 269-1.el8 baseos 533 k
cockpit-system noarch 269-1.el8 baseos 3.3 M
cockpit-ws x86_64 269-1.el8 baseos 1.3 M
coreutils x86_64 8.30-12.el8 baseos 1.2 M
coreutils-common x86_64 8.30-12.el8 baseos 2.0 M
cpio x86_64 2.12-11.el8 baseos 266 k
cronie x86_64 1.5.2-7.el8 baseos 119 k
cronie-anacron x86_64 1.5.2-7.el8 baseos 42 k
crypto-policies noarch 20211116-1.gitae470d6.el8 baseos 64 k
crypto-policies-scripts noarch 20211116-1.gitae470d6.el8 baseos 83 k
cryptsetup-libs x86_64 2.3.7-2.el8 baseos 488 k
cyrus-sasl-lib x86_64 2.1.27-6.el8_5 baseos 123 k
dbus x86_64 1:1.12.8-18.el8 baseos 41 k
dbus-common noarch 1:1.12.8-18.el8 baseos 46 k
dbus-daemon x86_64 1:1.12.8-18.el8 baseos 240 k
dbus-libs x86_64 1:1.12.8-18.el8 baseos 184 k
dbus-tools x86_64 1:1.12.8-18.el8 baseos 85 k
device-mapper x86_64 8:1.02.181-3.el8 baseos 377 k
device-mapper-libs x86_64 8:1.02.181-3.el8 baseos 410 k
dhcp-client x86_64 12:4.3.6-47.el8.0.1 baseos 318 k
dhcp-common noarch 12:4.3.6-47.el8.0.1 baseos 207 k
dhcp-libs x86_64 12:4.3.6-47.el8.0.1 baseos 148 k
dmidecode x86_64 1:3.3-4.el8 baseos 92 k
dnf noarch 4.7.0-9.el8 baseos 544 k
dnf-data noarch 4.7.0-9.el8 baseos 155 k
dnf-plugins-core noarch 4.0.21-11.el8 baseos 71 k
dracut x86_64 049-202.git20220511.el8 baseos 376 k
dracut-config-generic x86_64 049-202.git20220511.el8 baseos 60 k
dracut-config-rescue x86_64 049-202.git20220511.el8 baseos 61 k
dracut-network x86_64 049-202.git20220511.el8 baseos 109 k
dracut-squash x86_64 049-202.git20220511.el8 baseos 62 k
e2fsprogs x86_64 1.45.6-5.el8 baseos 1.0 M
e2fsprogs-libs x86_64 1.45.6-5.el8 baseos 233 k
elfutils-debuginfod-client x86_64 0.187-4.el8 baseos 73 k
elfutils-default-yama-scope noarch 0.187-4.el8 baseos 52 k
elfutils-libelf x86_64 0.187-4.el8 baseos 231 k
elfutils-libs x86_64 0.187-4.el8 baseos 297 k
ethtool x86_64 2:5.13-1.el8 baseos 219 k
expat x86_64 2.2.5-9.el8 baseos 113 k
file x86_64 5.33-20.el8 baseos 77 k
file-libs x86_64 5.33-20.el8 baseos 543 k
filesystem x86_64 3.8-6.el8 baseos 1.1 M
fontconfig x86_64 2.13.1-4.el8 baseos 274 k
fuse-libs x86_64 2.9.7-15.el8 baseos 102 k
gawk x86_64 4.2.1-4.el8 baseos 1.1 M
gdisk x86_64 1.0.3-11.el8 baseos 241 k
glib2 x86_64 2.56.4-159.el8 baseos 2.5 M
glibc x86_64 2.28-203.el8 baseos 2.2 M
glibc-all-langpacks x86_64 2.28-203.el8 baseos 26 M
glibc-common x86_64 2.28-203.el8 baseos 1.0 M
gnutls x86_64 3.6.16-4.el8 baseos 1.0 M
grub2-common noarch 1:2.02-123.el8 baseos 893 k
grub2-pc x86_64 1:2.02-123.el8 baseos 44 k
grub2-pc-modules noarch 1:2.02-123.el8 baseos 917 k
grub2-tools x86_64 1:2.02-123.el8 baseos 2.0 M
grub2-tools-extra x86_64 1:2.02-123.el8 baseos 1.1 M
grub2-tools-minimal x86_64 1:2.02-123.el8 baseos 211 k
grubby x86_64 8.40-42.el8 baseos 49 k
gsettings-desktop-schemas x86_64 3.32.0-6.el8 baseos 633 k
gssproxy x86_64 0.8.0-20.el8 baseos 119 k
gzip x86_64 1.9-13.el8 baseos 167 k
hdparm x86_64 9.54-4.el8 baseos 100 k
hostname x86_64 3.20-7.el8.0.1 baseos 32 k
hwdata noarch 0.314-8.12.el8 baseos 1.7 M
ima-evm-utils x86_64 1.3.2-12.el8 baseos 64 k
info x86_64 6.5-7.el8_5 baseos 198 k
initscripts x86_64 10.00.17-1.el8 baseos 340 k
iproute x86_64 5.15.0-4.el8 baseos 798 k
iptables-libs x86_64 1.8.4-22.el8 baseos 108 k
iputils x86_64 20180629-10.el8 baseos 148 k
jansson x86_64 2.14-1.el8 baseos 47 k
json-c x86_64 0.13.1-3.el8 baseos 41 k
kernel-tools x86_64 4.18.0-383.el8 baseos 8.3 M
kernel-tools-libs x86_64 4.18.0-383.el8 baseos 8.1 M
kexec-tools x86_64 2.0.24-1.el8 baseos 526 k
keyutils x86_64 1.5.10-9.el8 baseos 66 k
keyutils-libs x86_64 1.5.10-9.el8 baseos 34 k
kmod x86_64 25-19.el8 baseos 126 k
kmod-libs x86_64 25-19.el8 baseos 68 k
kpartx x86_64 0.8.4-24.el8 baseos 116 k
krb5-libs x86_64 1.18.2-20.el8 baseos 840 k
libX11 x86_64 1.6.8-5.el8 appstream 611 k
libX11-common noarch 1.6.8-5.el8 appstream 158 k
libarchive x86_64 3.3.3-3.el8_5 baseos 360 k
libblkid x86_64 2.32.1-35.el8 baseos 219 k
libcap x86_64 2.48-4.el8 baseos 74 k
libcap-ng x86_64 0.7.11-1.el8 baseos 33 k
libcom_err x86_64 1.45.6-5.el8 baseos 49 k
libcomps x86_64 0.1.18-1.el8 baseos 82 k
libdb x86_64 5.3.28-42.el8_4 baseos 751 k
libdb-utils x86_64 5.3.28-42.el8_4 baseos 150 k
libdnf x86_64 0.63.0-9.el8 baseos 702 k
libestr x86_64 0.1.10-3.el8 appstream 28 k
libfastjson x86_64 0.99.9-1.el8 appstream 38 k
libfdisk x86_64 2.32.1-35.el8 baseos 252 k
libffi x86_64 3.1-23.el8 baseos 37 k
libgcc x86_64 8.5.0-13.el8 baseos 80 k
libgcrypt x86_64 1.8.5-6.el8 baseos 463 k
libgomp x86_64 8.5.0-13.el8 baseos 207 k
libibverbs x86_64 37.2-1.el8 baseos 384 k
libldb x86_64 2.4.1-1.el8 baseos 188 k
libmodulemd x86_64 2.13.0-1.el8 baseos 233 k
libmount x86_64 2.32.1-35.el8 baseos 235 k
libndp x86_64 1.7-6.el8 baseos 40 k
libnfsidmap x86_64 1:2.3.3-51.el8 baseos 121 k
libpwquality x86_64 1.4.4-3.el8 baseos 107 k
librepo x86_64 1.14.2-1.el8 baseos 93 k
libseccomp x86_64 2.5.2-1.el8 baseos 71 k
libsemanage x86_64 2.9-8.el8 baseos 168 k
libsepol x86_64 2.9-3.el8 baseos 340 k
libsmartcols x86_64 2.32.1-35.el8 baseos 178 k
libsolv x86_64 0.7.20-3.el8 baseos 375 k
libss x86_64 1.45.6-5.el8 baseos 54 k
libssh x86_64 0.9.6-3.el8 baseos 216 k
libssh-config noarch 0.9.6-3.el8 baseos 19 k
libsss_autofs x86_64 2.6.2-3.el8 baseos 121 k
libsss_certmap x86_64 2.6.2-3.el8 baseos 164 k
libsss_idmap x86_64 2.6.2-3.el8 baseos 123 k
libsss_nss_idmap x86_64 2.6.2-3.el8 baseos 130 k
libsss_sudo x86_64 2.6.2-3.el8 baseos 119 k
libstdc++ x86_64 8.5.0-13.el8 baseos 454 k
libsysfs x86_64 2.1.0-25.el8 baseos 53 k
libtalloc x86_64 2.3.3-1.el8 baseos 49 k
libtdb x86_64 1.4.4-1.el8 baseos 59 k
libtevent x86_64 0.11.0-0.el8 baseos 50 k
libtirpc x86_64 1.1.4-6.el8 baseos 113 k
libuser x86_64 0.62-24.el8 baseos 414 k
libuuid x86_64 2.32.1-35.el8 baseos 97 k
libxcrypt x86_64 4.1.1-6.el8 baseos 73 k
libxml2 x86_64 2.9.7-14.el8 baseos 696 k
lshw x86_64 B.02.19.2-6.el8 baseos 341 k
lsscsi x86_64 0.32-3.el8 baseos 71 k
lua-libs x86_64 5.3.4-12.el8 baseos 118 k
lz4-libs x86_64 1.8.3-3.el8_4 baseos 66 k
man-db x86_64 baseos 887 k
microcode_ctl x86_64 4:20220207-1.el8 baseos 5.5 M
ncurses x86_64 6.1-9.20180224.el8 baseos 387 k
ncurses-base noarch 6.1-9.20180224.el8 baseos 81 k
ncurses-libs x86_64 6.1-9.20180224.el8 baseos 334 k
nettle x86_64 3.4.1-7.el8 baseos 301 k
nfs-utils x86_64 1:2.3.3-51.el8 baseos 504 k
numactl-libs x86_64 2.0.12-13.el8 baseos 36 k
openldap x86_64 2.4.46-18.el8 baseos 352 k
openssh x86_64 8.0p1-12.el8 baseos 522 k
openssh-clients x86_64 8.0p1-12.el8 baseos 668 k
openssh-server x86_64 8.0p1-12.el8 baseos 491 k
os-prober x86_64 1.74-9.el8 baseos 51 k
pam x86_64 1.3.1-18.el8 baseos 741 k
parted x86_64 3.2-39.el8 baseos 555 k
passwd x86_64 0.80-4.el8 baseos 115 k
pcre x86_64 8.42-6.el8 baseos 211 k
pixman x86_64 0.38.4-2.el8 appstream 257 k
platform-python x86_64 3.6.8-46.el8 baseos 86 k
platform-python-pip noarch 9.0.3-22.el8 baseos 1.6 M
policycoreutils x86_64 2.9-19.el8 baseos 374 k
policycoreutils-python-utils noarch 2.9-19.el8 baseos 253 k
polkit x86_64 0.115-13.0.1.el8.2 baseos 154 k
polkit-libs x86_64 0.115-13.0.1.el8.2 baseos 76 k
procps-ng x86_64 3.3.15-7.el8 baseos 329 k
python3-audit x86_64 3.0.7-4.el8 baseos 87 k
python3-babel noarch 2.5.1-7.el8 appstream 4.8 M
python3-cryptography x86_64 3.2.1-5.el8 baseos 559 k
python3-dnf noarch 4.7.0-9.el8 baseos 546 k
python3-dnf-plugins-core noarch 4.0.21-11.el8 baseos 240 k
python3-hawkey x86_64 0.63.0-9.el8 baseos 117 k
python3-jinja2 noarch 2.10.1-3.el8 appstream 538 k
python3-libcomps x86_64 0.1.18-1.el8 baseos 52 k
python3-libdnf x86_64 0.63.0-9.el8 baseos 778 k
python3-libs x86_64 3.6.8-46.el8 baseos 7.8 M
python3-libsemanage x86_64 2.9-8.el8 baseos 128 k
python3-libxml2 x86_64 2.9.7-14.el8 baseos 237 k
python3-linux-procfs noarch 0.7.0-1.el8 baseos 42 k
python3-perf x86_64 4.18.0-383.el8 baseos 8.2 M
python3-pip-wheel noarch 9.0.3-22.el8 baseos 895 k
python3-policycoreutils noarch 2.9-19.el8 baseos 2.2 M
python3-rpm x86_64 4.14.3-23.el8 baseos 155 k
python3-setools x86_64 4.3.0-3.el8 baseos 624 k
python3-slip noarch 0.6.4-13.el8 baseos 39 k
python3-slip-dbus noarch 0.6.4-13.el8 baseos 39 k
python3-syspurpose x86_64 1.28.28-1.el8 baseos 327 k
python3-unbound x86_64 1.7.3-17.el8 appstream 119 k
qemu-guest-agent x86_64 15:6.2.0-12.module_el8.7.0+1140+ff0772f9 appstream 340 k
quota x86_64 1:4.04-14.el8 baseos 214 k
quota-nls noarch 1:4.04-14.el8 baseos 95 k
rdma-core x86_64 37.2-1.el8 baseos 59 k
redhat-rpm-config noarch 130-1.el8 appstream 90 k
rng-tools x86_64 6.15-1.el8 baseos 74 k
rpm x86_64 4.14.3-23.el8 baseos 543 k
rpm-build-libs x86_64 4.14.3-23.el8 baseos 157 k
rpm-libs x86_64 4.14.3-23.el8 baseos 345 k
rpm-plugin-selinux x86_64 4.14.3-23.el8 baseos 78 k
rpm-plugin-systemd-inhibit x86_64 4.14.3-23.el8 baseos 79 k
rsync x86_64 3.1.3-14.el8 baseos 405 k
rsyslog x86_64 8.2102.0-9.el8 appstream 753 k
sed x86_64 4.5-5.el8 baseos 298 k
selinux-policy noarch 3.14.3-98.el8 baseos 647 k
selinux-policy-targeted noarch 3.14.3-98.el8 baseos 15 M
setroubleshoot-plugins noarch 3.3.14-1.el8 appstream 358 k
setroubleshoot-server x86_64 3.3.26-3.el8 appstream 389 k
shadow-utils x86_64 2:4.6-16.el8 baseos 1.2 M
sos noarch 4.2-15.el8 baseos 765 k
sqlite-libs x86_64 3.26.0-15.el8 baseos 581 k
squashfs-tools x86_64 4.3-20.el8 baseos 165 k
sssd-client x86_64 2.6.2-3.el8 baseos 226 k
sssd-common x86_64 2.6.2-3.el8 baseos 1.6 M
sssd-kcm x86_64 2.6.2-3.el8 baseos 252 k
sssd-nfs-idmap x86_64 2.6.2-3.el8 baseos 120 k
sudo x86_64 1.8.29-8.el8 baseos 925 k
systemd x86_64 239-58.el8 baseos 3.6 M
systemd-libs x86_64 239-58.el8 baseos 1.1 M
systemd-pam x86_64 239-58.el8 baseos 483 k
systemd-udev x86_64 239-58.el8 baseos 1.6 M
tpm2-tss x86_64 2.3.2-4.el8 baseos 275 k
tuned noarch 2.18.0-2.el8 baseos 316 k
tzdata noarch 2022a-2.el8 baseos 474 k
unbound-libs x86_64 1.7.3-17.el8 appstream 503 k
util-linux x86_64 2.32.1-35.el8 baseos 2.5 M
vim-minimal x86_64 2:8.0.1763-16.el8_5.12 baseos 575 k
virt-what x86_64 1.18-14.el8 baseos 37 k
which x86_64 2.21-18.el8 baseos 49 k
xfsprogs x86_64 5.0.0-10.el8 baseos 1.1 M
yum noarch 4.7.0-9.el8 baseos 206 k
yum-utils noarch 4.0.21-11.el8 baseos 73 k
zlib x86_64 1.2.11-19.el8 baseos 103 k
Installing dependencies:
NetworkManager-initscripts-updown noarch 1:1.39.5-1.el8 baseos 139 k
glibc-gconv-extra x86_64 2.28-203.el8 appstream 1.5 M
grub2-tools-efi x86_64 1:2.02-123.el8 baseos 476 k
libbpf x86_64 0.4.0-3.el8 baseos 125 k
linux-firmware noarch 20220210-107.git6342082c.el8 baseos 196 M
python3-netifaces x86_64 0.10.6-4.el8 appstream 25 k

Transaction Summary
Install 9 Packages
Upgrade 245 Packages

Total download size: 459 M
Is this ok [y/N]: y

3.) Install EPEL and REMI Repositories

Then let’s install both software repositories, including EPEL (Extra Packages for Enterprise Linux) and REMI. Simply execute using the following command.

$ dnf install
DigitalOcean Agent 65 kB/s | 3.3 kB 00:00
DigitalOcean Droplet Agent 53 kB/s | 3.3 kB 00:00
epel-release-latest-8.noarch.rpm 274 kB/s | 23 kB 00:00
Dependencies resolved.
Package Architecture Version Repository Size
epel-release noarch 8-15.el8 @commandline 23 k

Transaction Summary
Install 1 Package

Total size: 23 k
Installed size: 32 k
Is this ok [y/N]: y
$ rpm -qa | grep epel
$ dnf install
Last metadata expiration check: 0:00:15 ago on Wed 01 Jun 2022 11:27:43 AM UTC.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
remi-release-8.rpm 85 kB/s | 29 kB 00:00
Dependencies resolved.
Package Architecture Version Repository Size
remi-release noarch 8.6-1.el8.remi @commandline 29 k
centos-stream-release noarch 8.6-1.el8 baseos 22 k

Transaction Summary
Install 1 Package
Upgrade 1 Package

Total size: 51 k
Total download size: 22 k
Is this ok [y/N]: y
$ rpm -qa | grep remi

4.) List All Available PHP Version

After that you can check using the following command to list all available PHP branches inside your CentOS 8 machine. It will list all PHP version along with its modules.

$ dnf module list php
Remi's Modular repository for Enterprise Linux 8 - x86_64 1.3 kB/s | 833 B 00:00
Remi's Modular repository for Enterprise Linux 8 - x86_64 3.0 MB/s | 3.1 kB 00:00
Importing GPG key 0x5F11735A:
Userid : "Remi's RPM repository <[email protected]>"
Fingerprint: 6B38 FEA7 231F 87F5 2B9C A9D8 5550 9759 5F11 735A
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8
Is this ok [y/N]: y
Remi's Modular repository for Enterprise Linux 8 - x86_64 1.0 MB/s | 980 kB 00:00
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 1.5 kB/s | 833 B 00:00
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 3.0 MB/s | 3.1 kB 00:00
Importing GPG key 0x5F11735A:
Userid : "Remi's RPM repository <[email protected]>"
Fingerprint: 6B38 FEA7 231F 87F5 2B9C A9D8 5550 9759 5F11 735A
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8
Is this ok [y/N]: y
Safe Remi's RPM repository for Enterprise Linux 8 - x86_64 2.0 MB/s | 2.1 MB 00:01
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
CentOS Stream 8 - AppStream
Name Stream Profiles Summary
php 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 8.0 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
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[root@open-source ~]#

PLEASE NOTE: Kindly use the “Remi’s Modular repository for Enterprise Linux 8 – x86_64” to install only the stable release of PHP branches on your CentOS machine. Considering that it provide with the completed supported PHP version, starting from PHP 7.4, PHP 8.0, and PHP 8.1. Unlike the default AppStream repository on CentOS Stream 8 which provided PHP versions from the PHP 7.2, PHP 7.3, PHP 7.4, and PHP 8.0.

Let’s enable REMI repository for PHP 8.1 on CentOS Stream 8 using the following command:

$ dnf module enable php:remi-8.1
CentOS Stream 8 - Extras common packages 13 kB/s | 4.3 kB 00:00
DigitalOcean Agent 120 kB/s | 3.3 kB 00:00
DigitalOcean Droplet Agent 78 kB/s | 3.3 kB 00:00
Dependencies resolved.
Package Architecture Version Repository Size
Enabling module streams:
php remi-8.1

Transaction Summary

Is this ok [y/N]: y

5.) Install PHP 8.1

Lastly, simply execute using the following command line to install PHP 8.1 with FastCGI Process Manager (PHP-FPM) on your VPS. It will install PHP 8.1 along with all of its PHP extensions like PHP-FPM, XMLRPC, MySQL, Brotli, OPcache, Redis, Tidy, Mbstring, and much more.

$ dnf install php-fpm php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt php-mysql php-mysqlnd php-pdo php-soap php-tidy php-xml php-xmlrpc php-opcache php-redis php-pecl-mcrypt php-brotli
Last metadata expiration check: 0:01:35 ago on Wed 01 Jun 2022 11:56:06 AM UTC.
Dependencies resolved.
Package Architecture Version Repository Size
php x86_64 8.1.6-1.el8.remi remi-modular 1.7 M
php-bcmath x86_64 8.1.6-1.el8.remi remi-modular 89 k
php-brotli x86_64 0.13.1-1.el8.remi.8.1 remi-modular 30 k
php-cli x86_64 8.1.6-1.el8.remi remi-modular 5.3 M
php-common x86_64 8.1.6-1.el8.remi remi-modular 1.2 M
php-fpm x86_64 8.1.6-1.el8.remi remi-modular 1.8 M
php-gd x86_64 8.1.6-1.el8.remi remi-modular 105 k
php-imap x86_64 8.1.6-1.el8.remi remi-modular 109 k
php-mbstring x86_64 8.1.6-1.el8.remi remi-modular 521 k
php-mysqlnd x86_64 8.1.6-1.el8.remi remi-modular 255 k
php-opcache x86_64 8.1.6-1.el8.remi remi-modular 628 k
php-pdo x86_64 8.1.6-1.el8.remi remi-modular 161 k
php-pecl-mcrypt x86_64 1.0.5-1.el8.remi.8.1 remi-modular 35 k
php-pecl-mysql x86_64 1.0.0-0.25.20210423.ca514c4.el8.remi.8.1 remi-modular 43 k
php-pecl-redis5 x86_64 5.3.7-1.el8.remi.8.1 remi-modular 270 k
php-pecl-xmlrpc x86_64 1.0.0~rc3-1.el8.remi.8.1 remi-modular 62 k
php-soap x86_64 8.1.6-1.el8.remi remi-modular 232 k
php-tidy x86_64 8.1.6-1.el8.remi remi-modular 85 k
php-xml x86_64 8.1.6-1.el8.remi remi-modular 251 k
Installing dependencies:
apr x86_64 1.6.3-12.el8 appstream 129 k
apr-util x86_64 1.6.1-6.el8 appstream 105 k
centos-logos-httpd noarch 85.8-2.el8 appstream 75 k
fribidi x86_64 1.0.4-9.el8 appstream 89 k
gd3php x86_64 2.3.3-4.el8.remi remi-safe 146 k
graphite2 x86_64 1.3.10-10.el8 appstream 122 k
harfbuzz x86_64 1.7.5-3.el8 appstream 295 k
httpd x86_64 2.4.37-47.module_el8.6.0+1111+ce6f4ceb.1 appstream 1.4 M
httpd-filesystem noarch 2.4.37-47.module_el8.6.0+1111+ce6f4ceb.1 appstream 41 k
httpd-tools x86_64 2.4.37-47.module_el8.6.0+1111+ce6f4ceb.1 appstream 108 k
jbigkit-libs x86_64 2.1-14.el8 appstream 55 k
libXpm x86_64 3.5.12-8.el8 appstream 58 k
libc-client x86_64 2007f-24.el8 epel 564 k
libimagequant x86_64 2.12.5-1.el8 epel 63 k
libjpeg-turbo x86_64 1.5.3-12.el8 appstream 157 k
liblzf x86_64 3.6-16.el8 epel 28 k
libmcrypt x86_64 2.5.8-26.el8 epel 109 k
libraqm x86_64 0.7.0-4.el8 epel 19 k
libsodium x86_64 1.0.18-2.el8 epel 162 k
libtidy x86_64 5.6.0-5.el8 epel 227 k
libtiff x86_64 4.0.9-21.el8 appstream 188 k
libwebp x86_64 1.0.0-5.el8 appstream 272 k
libxslt x86_64 1.1.32-6.el8 baseos 250 k
mailcap noarch 2.1.48-3.el8 baseos 39 k
mod_http2 x86_64 1.15.7-5.module_el8.6.0+1111+ce6f4ceb appstream 155 k
oniguruma5php x86_64 6.9.8-1.el8.remi remi-safe 212 k
php-pecl-igbinary x86_64 3.2.7-1.el8.remi.8.1 remi-modular 203 k
php-pecl-msgpack x86_64 2.2.0~RC1-4.el8.remi.8.1 remi-modular 67 k
Installing weak dependencies:
apr-util-bdb x86_64 1.6.1-6.el8 appstream 25 k
apr-util-openssl x86_64 1.6.1-6.el8 appstream 27 k
nginx-filesystem noarch 1:1.14.1-9.module_el8.0.0+1060+3ab382d3 appstream 24 k
php-sodium x86_64 8.1.6-1.el8.remi remi-modular 101 k
Enabling module streams:
httpd 2.4
nginx 1.14

Transaction Summary
Install 51 Packages

Total download size: 18 M
Installed size: 70 M
Is this ok [y/N]: y

6.) Verify PHP Version

You can verify PHP branch which installed on your CentOS machine using the following command to print detailed version of your PHP release.

$ php -v
PHP 8.1.6 (cli) (built: May 11 2022 01:14:18) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
with Zend OPcache v8.1.6, Copyright (c), by Zend Technologies

7.) Manage PHP 8.1 with FastCGI Process Manager (FPM)

You can manage your PHP 8.1 with a FastCGI Process Manager (FPM) on your CentOS Stream 8 like start, stop, restart, or check the service state using below command lines.

READ:  How To Install MultiPHP-FPM (PHP 7.4, PHP 8.0, & PHP 8.1) on Debian 11 "bullseye"

* Enable PHP-FPM to Start Automatically from Boot

$ systemctl enable php-fpm
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/php-fpm.service.

* To Start PHP-FPM Service

$ systemctl start php-fpm

* To Stop PHP-FPM

$ systemctl stop php-fpm

* To Restart PHP-FPM

$ systemctl restart php-fpm

* To Check Service State of PHP-FPM

$ systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2022-06-01 12:03:42 UTC; 8s ago
Main PID: 85227 (php-fpm)
Status: "Ready to handle connections"
Tasks: 6 (limit: 4744)
Memory: 16.6M
CGroup: /system.slice/php-fpm.service
├─85227 php-fpm: master process (/etc/php-fpm.conf)
├─85228 php-fpm: pool www
├─85229 php-fpm: pool www
├─85230 php-fpm: pool www
├─85231 php-fpm: pool www
└─85232 php-fpm: pool www

Jun 01 12:03:41 open-source.project systemd[1]: Starting The PHP FastCGI Process Manager...
Jun 01 12:03:42 open-source.project systemd[1]: Started The PHP FastCGI Process Manager.


By reading this articles, you have know right now that the installation and configuration procedure for a PHP 8.1 with FastCGI Process Manager (PHP-FPM) is easy enough to implement on CentOS Stream 8 and other RedHat-8-based distros like CloudLinux 8, Oracle Linux 8, Amazon Linux 3, Rocky Linux 8 and AlmaLinux OS 8.5. It become primary reason why we should run the web-platform without a Graphical User Interface or GUI (Control Panel, e.g. cPanel-WHM or Plesk Panel) in order to built secure, advanced, robust, scalable, and high-performance production server environment under Linux-based operating system.

READ:  How To Install OpenResty v1.21.4.1 on CentOS Stream 8
System Update on CentOS 8 Stream
System Update on CentOS 8 Stream

Later you can continue to deploy a simple web application under OpenResty web-platform that combined with PHP-FPM to support heavy-loaded infrascructure and the long-term stable version of MariaDB 10.6 database server. Or you can place it first on the temporary development environment before move your application code into the actual production machine.

Leave a Comment