CentOS Stream 9
Sponsored Link

PHP 8.2 : インストール2024/06/04

 
PHP 8.2 をインストールします。
[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
php       8.2         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.2
# PHP 8.1 を指定してインストール

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

Dependencies resolved.
================================================================================
 Package           Arch    Version                             Repository  Size
================================================================================
Installing group/module packages:
 php-cli           x86_64  8.2.13-1.module_el9+766+427f1f3d    appstream  3.6 M
 php-common        x86_64  8.2.13-1.module_el9+766+427f1f3d    appstream  699 k
 php-fpm           x86_64  8.2.13-1.module_el9+766+427f1f3d    appstream  1.8 M
 php-mbstring      x86_64  8.2.13-1.module_el9+766+427f1f3d    appstream  522 k
 php-xml           x86_64  8.2.13-1.module_el9+766+427f1f3d    appstream  146 k
Installing dependencies:
 httpd-filesystem  noarch  2.4.57-8.el9                        appstream   13 k
 nginx-filesystem  noarch  1:1.20.1-16.el9                     appstream  9.3 k
Installing module profiles:
 php/common

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

[root@dlp ~]#
php -v

PHP 8.2.13 (cli) (built: Nov 21 2023 09:55:59) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.13, 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.2.13

System => Linux localhost.localdomain 5.14.0-452.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Sat May 18 20:39:48 UTC 2024 x86_64
Build Date => Nov 21 2023 09:55:59
Build System => CentOS Stream release 9
Build Provider => CentOS
Compiler => gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)
Architecture => x86_64
Server API => Command Line Interface
関連コンテンツ