CentOS Stream 8にPHP8.1をインストールする

環境
# cat /etc/redhat-release
CentOS Stream release 8

インストールの方法
1.リポジトリを追加します
# sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

2.システムパッケージをアップデートします
# sudo dnf update

3.有効になっている PHP のバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf module list php
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language
# dnf module list php Remi's Modular repository for Enterprise Linux 8 - x86_64 Name Stream Profiles Summary 略 php remi-8.0 common [d], devel, minimal PHP scripting language php remi-8.1 common [d], devel, minimal PHP scripting language
#  dnf module list php
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name         Stream             Profiles                               Summary
略
php          remi-8.0           common [d], devel, minimal             PHP scripting language
php          remi-8.1           common [d], devel, minimal             PHP scripting language

4. 他バージョンが有効な場合は一旦リセットします
# dnf module reset php

5.remi-8.1のアクティブ化を行います
# dnf module enable php:remi-8.1

6.PHP8.1をインストールします
# dnf install php php-cli php-common

7.phpバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# php -v
PHP 8.1.1 (cli) (built: Dec 15 2021 02:00:45) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies
# php -v PHP 8.1.1 (cli) (built: Dec 15 2021 02:00:45) (NTS gcc x86_64) Copyright (c) The PHP Group Zend Engine v4.1.1, Copyright (c) Zend Technologies with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies
# php -v
PHP 8.1.1 (cli) (built: Dec 15 2021 02:00:45) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.1, Copyright (c), by Zend Technologies

 

CentOS Stream 8

Posted by arkgame