Table of Contents
PHP8.2にバージョンアップ
利用できるPHPのバージョンを確認
[root@scct08 ~]# dnf module list php
AlmaLinux 8 - AppStream
Name Stream Profiles Summary
php 7.2 [d] common [d], devel, minimal PHP scripting language
php 7.3 common [d], devel, minimal PHP scripting language
php 7.4 common [d], devel, minimal PHP scripting language
php 8.0 common [d], devel, minimal PHP scripting language
Remi's Modular repository for Enterprise Linux 8 - x86_64
Name Stream Profiles Summary
php remi-7.2 common [d], devel, minimal PHP scripting language
php remi-7.3 common [d], devel, minimal PHP scripting language
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 [e] common [d], devel, minimal PHP scripting language
php remi-8.2 common [d], devel, minimal PHP scripting language
PHPとApacheの停止
[root@scct08 ~]# systemctl stop php-fpm
[root@scct08 ~]# systemctl stop httpd
PHPのリセット
[root@scct08 ~]# dnf module reset php
PHPのインストールするバージョンを指定
[root@scct08 ~]# dnf module enable php:remi-8.2
PHPのアップデート
[root@scct08 ~]# dnf module -y update php:remi-8.2
エラーが発生したのでsmbclient、PhpRedisを再インストール
[root@scct08 ~]# php -v
PHP Warning: PHP Startup: smbclient: Unable to initialize module
Module compiled with module API=20210902
PHP compiled with module API=20220829
These options need to match
in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'redis.so' (tried: /usr/lib64/php/modules/redis.so (/usr/lib64/php/modules/redis.so: undefined symbol: _zend_get_parameters_array_ex), /usr/lib64/php/modules/redis.so.so (/usr/lib64/php/modules/redis.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 8.2.5 (cli) (built: Apr 11 2023 16:16:23) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.5, Copyright (c) Zend Technologies
with Zend OPcache v8.2.5, Copyright (c), by Zend Technologies
smbclient
[root@scct08 ~]# pecl uninstall smbclient
[root@scct08 ~]# pecl install smbclient
PhpRedis
Redisを参照
PHPの起動と状態確認
[root@scct08 ~]# systemctl restart php-fpm
[root@scct08 ~]# systemctl status php-fpm
PHPの自動起動化
[root@scct08 ~]# systemctl enable php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@scct08 ~]# systemctl is-enabled php-fpm
enabled
Apacheの起動
[root@scct08 ~]# systemctl restart httpd
動作確認
[root@scct08 ~]# php -v
PHP 8.1.12 (cli) (built: Oct 25 2022 17:30:00) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.12, Copyright (c) Zend Technologies
with Zend OPcache v8.1.12, Copyright (c), by Zend Technologies
# vi /var/www/status/phpinfo.php
----------------------------------------
<?php phpinfo(); ?>
----------------------------------------
http://www.chinaz.org/status/phpinfo.php