AlmaLinux 9
Sponsored Link

PHP 8.1 : Install2023/03/03

 
Install PHP 8.1.
[1] Confirm the current enabled version of PHP and Install it.
[root@dlp ~]#
dnf module list php

AlmaLinux 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

# 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.1
# specify PHP 8.1 and install

[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

# 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.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
Matched Content