apt install phpX.X
You would use this method in cases like Debian, where the repo default is 7.4, which is EOL.
Use this script to install the repo and its key (source)
#!/bin/sh
# To add this repository please do:
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
fi
${SUDO} apt-get update
${SUDO} apt-get -y install lsb-release ca-certificates curl
${SUDO} curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
${SUDO} dpkg -i /tmp/debsuryorg-archive-keyring.deb
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update
dnf install epel-release && \
dnf install http://rpms.remirepo.net/enterprise/remi-release-9.rpm
To install dnf utilities
dnf install dnf-utils
To enable php 8.2 Remi repository.
dnf module reset php
Install
dnf module install php:remi-8.2