Upgrading from PHP 7 to PHP 8

Prerequisites

  • Open a terminal window with the root user and enter the following command:
php --version

You will get an answer similar to the following:

PHP 7.4.29 (cli) (built: Apr 12 2022 10:55:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

CentOS 7

  • Configure the repositories:
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install yum-utils
yum-config-manager --disable 'remi-php*'
yum-config-manager --enable remi-php80
  • Install PHP 8 and its dependencies:
yum install -y \
 php php-mcrypt php-cli php-gd php-curl php-mysql \
 php-ldap php-zip php-fileinfo php-snmp php-mbstring \
 php-pecl-zip php-xmlrpc libxslt php-xml php-fpm
  • Verify the version installed with:
php --version

You will get an answer similar to the following:

PHP 8.0.19 (cli) (built: May 10 2022 08:07:35) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.19, Copyright (c) Zend Technologies

Rocky Linux 8/AlmaLinux 8/RHEL 8

  • Configure the repositories:
dnf module reset php -y
dnf module enable php:remi-8.0
  • Install PHP:
dnf install -y php php-fpm
  • Install dependencies:
dnf install -y \
 php-cli php-fpm php-curl php-mysqlnd php-gd php-opcache php-zip \
 php-intl php-common php-bcmath php-imap php-imagick php-xmlrpc \
 php-json php-readline php-memcached php-redis php-mbstring php-apcu \
 php-xml php-dom php-redis php-memcached php-memcache
  • Verify the version installed:
php --version

You will get an answer similar to the following:

PHP 8.0.19 (cli) (built: May 10 2022 08:07:35) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.19, Copyright (c) Zend Technologies

Go back to Pandora FMS documentation index