2022年8月29日 星期一

LibreNMS 於 CentOS-7 將 php7.4 更新至 php8.1

 LibreNMS 將於 2022年 九月份開始要求 php 最低版本需求為 php 8.1。

[WARN]  PHP version 8.1 is the minimum supported version as of September, 2022. We recommend you update PHP to a supported version (8.1 suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates.

若未更新將無法取得 LibreNMS 新版本更新與修正,將 php 7.4 更新至 php 8.1 請用本文依序操作。


輸入 ./validate.php 顯示下面問題。

[WARN]  PHP version 8.1 is the minimum supported version as of September, 2022. We recommend you update PHP to a supported version (8.1 suggested) to continue to receive updates. If you do not update PHP, LibreNMS will continue to function but stop receiving bug fixes and updates.


更新 local package index:

[librenms@localhost ~]$ sudo yum update -y


部署 PHP 的 (Remi) 存儲庫:

[librenms@localhost ~]$ sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

[librenms@localhost ~]$ sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

[librenms@localhost ~]$ sudo yum -y install yum-utils


禁用與啟用 PHP 的 Remi 存儲庫:

[librenms@localhost ~]$ sudo yum-config-manager --disable 'remi-php*'

[librenms@localhost ~]$ sudo yum-config-manager --enable remi-php81


查看啟用的 PHP 8.1 的 Remi 存儲庫:

[librenms@localhost ~]$ sudo yum repolist


應該得到以下輸出:

remi-php81            Remi's PHP 8.1 RPM repository for Enterprise Linux 7 - x86_64


安裝 PHP 8.1:

[librenms@localhost ~]$ sudo yum install php


安裝額外的 PHP 擴展:

[librenms@localhost ~]$ sudo yum -y install php php-{cli,fpm,mysqlnd,zip,devel,gd,mbstring,curl,xml,pear,bcmath,json,opcache,redis,memcache}


檢查 PHP 8 版本和可用擴展:

[librenms@localhost ~]$ php --version

PHP 8.1.9 (cli) (built: Aug  2 2022 13:02:24) (NTS gcc x86_64)

Copyright (c) The PHP Group

Zend Engine v4.1.9, Copyright (c) Zend Technologies

    with Zend OPcache v8.1.9, Copyright (c), by Zend Technologies

[librenms@localhost ~]$ php --modules

[PHP Modules]

bcmath

bz2

calendar

Core

ctype

curl

date

dom

exif

fileinfo

filter

ftp

gd

gettext

hash

iconv

igbinary

json

libxml

mbstring

mcrypt

memcache

msgpack

mysqli

mysqlnd

openssl

pcntl

pcre

PDO

pdo_mysql

pdo_sqlite

Phar

posix

readline

redis

Reflection

session

shmop

SimpleXML

sockets

sodium

SPL

sqlite3

standard

sysvmsg

sysvsem

sysvshm

tokenizer

xml

xmlreader

xmlwriter

xsl

Zend OPcache

zlib


[Zend Modules]

Zend OPcache


查看 ./validate.php 驗證更新結果:

[librenms@localhost ~]$ ./validate.php

====================================

Component | Version

--------- | -------

LibreNMS  | 22.8.0

DB Schema | 2022_07_03_1947_add_app_data (244)

PHP       | 8.1.9

Python    | 3.6.8

Database  | MariaDB 10.5.17-MariaDB

RRDTool   | 1.4.8

SNMP      | 5.7.2

====================================


[OK]    Composer Version: 2.4.1

[OK]    Dependencies up-to-date.

[OK]    Database connection successful

[OK]    Database Schema is current

[OK]    SQL Server meets minimum requirements

[OK]    lower_case_table_names is enabled

[OK]    MySQL engine is optimal

[OK]    Database schema correct

[OK]    MySQl and PHP time match


以上完成更新步驟。


參考資料:

https://orcacore.com/install-php-8-1-centos-7/

https://computingforgeeks.com/how-to-install-php-centos-rhel-linux/


沒有留言:

張貼留言