Table of Contents
Installing and updating PHP 7
Prerequisites
Consult about backup and recovery procedures before doing any installation or upgrade to Pandora FMS.
PHP 7.2 → For Pandora FMS versions from 729 to 758.
PHP7.4 → For Pandora FMS versions from 759 to 767.
For version 760 (and later) of Pandora FMS visit “Upgrading from PHP 7 to PHP 8”.
PHP 7 Installation
Run as root or use sudo for all commands to use.
CentOS
First, check that there is no previous PHP version installed in the machine, using the command:
php –v
Once verified that php has been uninstalled correctly, download the EPEL and Remi (repository with the latest versions of PHP 7):
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
In order to use the yum-config-manager command you must have yum-utils installed, verify your installation with the following command:
yum install yum-utils
For install PHP 7.2 version:
yum-config-manager --enable remi-php72
For install PHP 7.4 version:
yum-config-manager --enable remi-php74
Finally, install the selected PHP version:
yum install 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
And check the installed version:
PHP 7 Update
Run as root or use sudo for all commands to use.
CentOS
Check PHP version installed in the machine:
php –v
Download the EPEL and Remi (repository with the latest versions of PHP 7):
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
In order to use the yum-config-manager command you must have yum-utils installed, verify your installation with the following command:
yum install yum-utils
For install PHP 7.2 version:
yum-config-manager --disable 'remi-php*' yum-config-manager --enable remi-php72
For install PHP 7.4 version:
yum-config-manager --disable 'remi-php*' yum-config-manager --enable remi-php74
Finally, install the selected PHP version:
yum install 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
And check the installed version:
Rocky Linux 8
PHP version by default is PHP 7.2, update to PHP 7.4 with:
dnf module reset php -y dnf module enable php:7.4 dnf update -y
Check new version with php -v
:
php.ini file
There is also the possibility that during the upgrade process to php7, the php.ini file is affected. Here is an example of some of the data that php.ini must include:
engine = On precision = 14 output_buffering = 4096 serialize_precision = 1 zend.enable_gc = On expose_php = On max_execution_time = 0 max_input_time = -1 memory_limit = 800M error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_USER_WARNING log_errors = On log_errors_max_len = 1024 report_memleaks = On html_errors = On variables_order = "GPCS" request_order = "GP" auto_globals_jit = On post_max_size = 800M default_mimetype = "text/html" default_charset = "UTF-8" file_uploads = On upload_max_filesize = 800M max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 cli_server.color = On pcre.jit=0 pdo_mysql.cache_size = 2000 sendmail_path = /usr/sbin/sendmail -t -i mail.add_x_header = On