【php】redhatでphpのバージョンを8.0⇒8.3に上げてみた

redhatのサーバーでphpを8.0から8.3にバージョンアップする事になった。

正直あまり意味はない気がするけど、セキュリティ的な観点からは良いのかもしれない。

ちなみにredhatのバージョンは9.7。

調べると、9.7にはそもそもphp8.3が元々入っているらしい?

dnf module list

で見てみると

[root@eba47cf9bd2f /]# dnf module list
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 22:27:41 ago on Tue Jan 27 09:36:58 2026.
Remi’s Modular repository for Enterprise Linux 9 – x86_64
Name Stream Profiles Summary
composer 2 common [d] Dependency Manager for PHP
memcached remi common [d] High Performance, Distributed Memory Object Cache
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 [e] common [d] [i], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language
php remi-8.2 common [d], devel, minimal PHP scripting language
php remi-8.3 common [d], devel, minimal PHP scripting language
php remi-8.4 common [d], devel, minimal PHP scripting language
php remi-8.5 common [d], devel, minimal PHP scripting language

今使っているphpバージョンには「e」が付くので

remi-8.0 [e]

となっているので、今のバージョンが8.0だとわかる。

ひょっとするとすごい簡単にバージョンアップ出来るのかも?

dnf module enable php:8.3

で8.3に切り替えられるらしい。

やってみる

[root@eba47cf9bd2f /]# dnf module enable php:8.3
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 22:33:13 ago on Tue Jan 27 09:36:58 2026.
Dependencies resolved.
The operation would result in switching of module ‘php’ stream ‘remi-8.0’ to stream ‘8.3’
Error: It is not possible to switch enabled streams of a module unless explicitly enabled via configuration option module_stream_switch.
It is recommended to rather remove all installed content from the module, and reset the module using ‘dnf module reset <module_name>’ command. After you reset the module, you can install the other stream.

エラー出たし!!

8.3のインストールが必要なのか?

dnf module reset php
dnf module install -y php:remi-8.3

 

でやってみる

[root@eba47cf9bd2f /]# dnf module reset php
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 22:35:49 ago on Tue Jan 27 09:36:58 2026.
Dependencies resolved.
================================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================================
Disabling module profiles:
php/common
Resetting modules:
php

Transaction Summary
================================================================================================================================================================================

Is this ok [y/N]: y
Complete!

これでリセットされたらしい。

次に8.3をインストール

[root@eba47cf9bd2f /]# dnf module install -y php:remi-8.3
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 22:36:19 ago on Tue Jan 27 09:36:58 2026.
Dependencies resolved.
================================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================================
Upgrading:
php x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 1.8 M
php-cli x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 5.6 M
php-common x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 1.3 M
php-devel x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 778 k
php-fpm x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 1.9 M
php-gd x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 63 k
php-intl x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 236 k
php-mbstring x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 579 k
php-odbc x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 65 k
php-opcache x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 575 k
php-pdo x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 118 k
php-pecl-xmlrpc x86_64 1.0.0~rc3-10.el9.remi.8.3 remi-modular 63 k
php-pecl-zip x86_64 1.22.7-1.el9.remi.8.3 remi-modular 78 k
php-process x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 67 k
php-soap x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 204 k
php-sodium x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 60 k
php-xml x86_64 8.3.30-1.module_php.8.3.el9.remi remi-modular 219 k
Installing dependencies:
capstone x86_64 4.0.2-10.el9 ubi-9-appstream-rpms 770 k
Installing weak dependencies:
php-nikic-php-parser5 noarch 5.7.0-1.el9 epel 178 k
Installing module profiles:
php/common
Enabling module streams:
php remi-8.3

Transaction Summary
================================================================================================================================================================================
Install 2 Packages
Upgrade 17 Packages

Total download size: 15 M
Downloading Packages:
(1/19): php-nikic-php-parser5-5.7.0-1.el9.noarch.rpm 932 kB/s | 178 kB 00:00
(2/19): capstone-4.0.2-10.el9.x86_64.rpm 2.5 MB/s | 770 kB 00:00
(3/19): php-8.3.30-1.module_php.8.3.el9.remi.x86_64.rpm 600 kB/s | 1.8 MB 00:03
(4/19): php-common-8.3.30-1.module_php.8.3.el9.remi.x86_64.rpm 362 kB/s | 1.3 MB 00:03
(5/19): php-devel-8.3.30-1.module_php.8.3.el9.remi.x86_64.rpm 417 kB/s | 778 kB 00:01
(6/19): php-gd-8.3.30-1.module_php.8.3.el9.remi.x86_64.rpm 61 kB/s | 63 kB 00:01
(7/19): php-fpm-8.3.30-1.module_php.8.3.el9.remi.x86_64.rpm 539 kB/s | 1.9 MB 00:03

Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.

よし、成功

これで8.3になった?

[root@eba47cf9bd2f /]# php -v
PHP 8.3.30 (cli) (built: Jan 13 2026 22:36:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.3.30, Copyright (c) Zend Technologies
with Zend OPcache v8.3.30, Copyright (c), by Zend Technologies

無事8.3になっている!!!

こんなに簡単なの?

コメント