CentOS Stream 9
Sponsored Link

PHP 8.1 : インストール2022/09/28

 
PHP 8.1 をインストールします。
[1] 現在、有効になっている PHP のバージョンを確認してインストールします。
[root@dlp ~]#
dnf module list php

CentOS Stream 9 - AppStream
Name      Stream      Profiles                        Summary
php       8.1         common [d], devel, minimal      PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

# 他バージョンが有効な場合は一旦リセットして有効バージョンを切り替え

[root@dlp ~]#
dnf module reset php

[root@dlp ~]#
dnf module -y enable php:8.1
# PHP 8.1 を指定してインストール

[root@dlp ~]#
dnf module -y install php:8.1/common

Dependencies resolved.
================================================================================
 Package           Arch    Version                             Repository  Size
================================================================================
Installing group/module packages:
 php-cli           x86_64  8.1.8-1.module_el9+158+97f99411     appstream  3.5 M
 php-common        x86_64  8.1.8-1.module_el9+158+97f99411     appstream  683 k
 php-fpm           x86_64  8.1.8-1.module_el9+158+97f99411     appstream  1.8 M
 php-mbstring      x86_64  8.1.8-1.module_el9+158+97f99411     appstream  476 k
 php-xml           x86_64  8.1.8-1.module_el9+158+97f99411     appstream  145 k
Installing dependencies:
 httpd-filesystem  noarch  2.4.53-7.el9                        appstream   15 k
 nginx-filesystem  noarch  1:1.20.1-13.el9                     appstream   12 k
Installing module profiles:
 php/common

Transaction Summary
================================================================================
Install  7 Packages
.....
.....

[root@dlp ~]#
php -v

PHP 8.1.8 (cli) (built: Jul  5 2022 21:55:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.8, Copyright (c) Zend Technologies

# テストスクリプトを作成して動作確認

[root@dlp ~]#
echo '<?php echo `php -i`."\n"; ?>' > php_test.php

[root@dlp ~]#
php php_test.php | head

phpinfo()
PHP Version => 8.1.8

System => Linux dlp.srv.world 5.14.0-165.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Sep 17 14:08:33 UTC 2022 x86_64
Build Date => Jul  5 2022 21:55:55
Build System => CentOS Stream release 9
Build Provider => CentOS
Compiler => gcc (GCC) 11.3.1 20220421 (Red Hat 11.3.1-2)
Architecture => x86_64
Server API => Command Line Interface
関連コンテンツ