CentOS Stream 9
Sponsored Link

PHP 8.2 : Install2024/06/04

 
Install PHP 8.2.
[1] Confirm the current enabled version of PHP and Install it.
[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

# if other versions are enabled, reset once and switch to the version

[root@dlp ~]#
dnf module reset php

[root@dlp ~]#
dnf module -y enable php:8.2
# specify PHP 8.1 and install

[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

# verify to create test script

[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
Matched Content