Install PHP 8.2 on Fedora, RHEL, CentOS, Alma, Rocky or other clone
+
Par Remi le mercredi 19 avril 2023, 07:31 - HowTo - Lien permanent
Here is a quick howto upgrade default PHP version provided on Fedora, RHEL, CentOS, AlmaLinux, Rocky Linux or other clones with latest version 8.2.
You can also follow the Wizard instructions.
Repositories configuration:
On Fedora, standards repositories are enough, on Enterprise Linux (RHEL, CentOS) the Extra Packages for Enterprise Linux (EPEL) and Code Ready Builder (CRB) repositories must be configured, and on RHEL-7 the optional channel must be enabled.
Fedora 38
dnf install https://rpms.remirepo.net/fedora/remi-release-38.rpm
Fedora 37
dnf install https://rpms.remirepo.net/fedora/remi-release-37.rpm
RHEL version 9.1
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms
RHEL version 8.5
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms
RHEL version 7.9
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm subscription-manager repos --enable=rhel-7-server-optional-rpms
Alma, CentOS Stream, Rocky version 9
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm crb install
Alma, CentOS Stream, Rocky version 8
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm crb install
CentOS version 7
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm wget https://rpms.remirepo.net/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7.rpm epel-release-latest-7.noarch.rpm
php module usage
With Fedora and EL ≥ 8, you can simply use the remi-8.2 stream of the php module
dnf module reset php dnf module install php:remi-8.2
remi-php82 repository activation
Needed packages are in the remi-safe (enabled by default) and remi-php82 repositories, the latest is not enabled by default (administrator choice according to the desired PHP version).
RHEL or CentOS 7
yum install yum-utils yum-config-manager --enable remi-php82
PHP upgrade
By choice, the packages have the same name than in the distribution, so a simple update is enough:
yum update
That's all :)
$ php -v PHP 8.2.5 (cli) (built: Apr 11 2023 16:16:23) (NTS gcc x86_64) Copyright (c) The PHP Group Zend Engine v4.2.5, Copyright (c) Zend Technologies with Zend OPcache v8.2.5, Copyright (c), by Zend Technologies
Known issues
The upgrade can fail (by design) when some installed extensions are not yet compatible with PHP 8.2.
See the compatibility tracking list: PECL extensions RPM status
If these extensions are not mandatory, you can remove them before the upgrade, else, you will have to be patient.
Warning: some extensions are still under development, but it seems useful to provide them to allow upgrade to more people, and to allow user to give feedback to the authors.
More d'information
If you prefer to install PHP 8.2 beside the default PHP version, this can be achieved using the php82 prefixed packages, see the PHP 8.2 as Software Collection post.
You can also try the configuration wizard.
The packages available in the repository was used as sources for Fedora 38.
By providing a full feature PHP stack, with about 130 available extensions, 9 PHP versions, as base and SCL packages, for Fedora and Enterprise Linux, and with 300 000 download per day, remi repository became in the last 18 years a reference for PHP users on RPM based distributions, maintained by an active contributor to the projects (Fedora, PHP, PECL...).
See also:
- Posts RSS feed (versions announcements)
- Comments RSS feed
- Repository RSS feed (example for EL-9, php 8.2)
- Install PHP 8.1 on Fedora RHEL CentOS Alma Rocky or other clone
- Install PHP 8.0 on Fedora RHEL CentOS Alma Rocky or other clone