Pandora: Documentation en: PHP 7

From Pandora FMS Wiki
Jump to: navigation, search

1 Prerequisites

PHP7 installation must be done with rpm/deb/OUM ... of the console in version 729 or later. Otherwise Pandora FMS will experience a dependencies conflict since it requires PHP5 for previous versions.

Info.png

In case of installing from 728 to 729, if we have the PHP7 repository configured in our system, it will try to install that repository automatically when updating the console.

 


2 Installing & updating PHP 7

2.1 PHP 7 Installation

2.1.1 CentOS

First, we'll check that there is no previous version of php installed on the machine using the command from:

php –v


VersionLinuxNada.png



Once verified that we have uninstalled correctly php, we will download the repositories of epel and remi with the latest versions to install:

# 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


For CentOS 6 versions, we will download it from here:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm 
# yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


Epel.png





Remi.png



Next, we'll install yum-utils in case of not having installed it previously in our machine to be able to use the command yum-config-manager:

yum install yum-utils
yum-config-manager --enable remi-php72


Yum manager.png



Finally, we'll install version php7.2 on our system:

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


Yum Install php.png



And we check the installed version



Version 7 php.png



For the correct operation of Pandora FMS with PHP version 7.2, we will need to add some PHP packages that are:

yum install php-xmlrpc libkslt php-xml


Librerias 7 php.png



2.1.2 Windows

In the first place, we must go to the website https://windows.php.net/download/ to download the PHP 7.2 version we need. In our case we'll download the version VC15 x64 Thread Safe.



DescargaPhp7.jpg



Once the zip is downloaded, we'll unzip it in the folder C:\php.

When the folder is created, we'll copy the file php.ini-production and rename it as php.ini.

To finish, we must change the httpd-php.conf file, and change the LoadFile and LoadModule to this:



Httpd-php.png



2.2 PHP 7 Update

2.2.1 CentOS

We will download the repositories of epel and remi with the latest versions to install:

# 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

For CentOS 6 versions, we will download it from here:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm 
# yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


Epel.png





Remi.png



Next, we'll install yum-utils in case we don't have it previously installed in our machine to be able to use the command yum-config-manager:

yum install yum-utils
yum-config-manager --enable remi-php72


Yum manager.png



Finally, we'll install the php7.2 version on our system:

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


Yum Install php.png



And we check the installed version



Version 7 php.png



For the correct operation of Pandora FMS with PHP version 7.2, we will need to add some PHP packages which are:

yum install php-xmlrpc libkslt php-xml


Librerias 7 php.png



If we had some version of Pandora FMS installed in our machine, we will have to reinstall the Pandora FMS console for its correct operation, due to the changes of PHP version, as we can see in the following link.

In case you see any notice of incompatibility with the Pandora FMS Console package installed, you should copy the rpm of version 729 into this directory or execute the following command.

rpm -U --force *.rpm --nodeps


It can exist the possibility that during the upgrade to php7, the php.ini file is affected. Here is an example of some of the data that php.ini must have:

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 = 500M
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

2.2.2 Windows

First, we must go to the website: https://windows.php.net/download/ to download the PHP 7.2 version we need. In our case we'll download the version VC15 x64 Thread Safe.



DescargaPhp7.jpg



Once the zip is downloaded, we'll unzip it in the folder C:\php.



DescompilarPhp7.jpg



Next, we'll go to the folder located in C:\PandoraFMS\php, and rename it to php_versionActual and copy the new php folder we've created.



CambioCarpeta.png



When the folder is created, we'll copy the file php.ini-production and rename it as php.ini.

After finishing this step, we will have to copy the file libsals.dll y reemplazaarlo fror the same file in the Apache folder C:\PandoraFMS\Apache\bin.

The installation of Microsoft Visual C++ 2015: https://www.microsoft.com/en-us/download/details.aspx?id=48145 will also be necessary for Pandora FMS to properly function.

To finish, we must change the httpd-php.conf file, and change the LoadFile and LoadModule to this:




Httpd-php.png



2.2.3 Ubuntu

In order to upgrade to php7 it is necessary to add it to the repository using the following command:

sudo add-apt-repository ppa:ondrej/php 

Once this step is done, we will have to do an update to install it:

sudo apt-get update

To make sure that all apache packages have been installed correctly, and to confirm that apache will be able to run with the new version, we will run as well the following command:

sudo apt-get install php7.2

And the same for the rest of dependencies:

sudo apt-get install php7.2-mysql php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-json php7.2-ldap php7.2-mbstring php7.2-opcache php7.2-readline php7.2-snmp php7.2-xml php7.2-xmlrpc php7.2-zip

In case that both versions of php maintains, the old php version must be disabled so the new php7 version can be enabled. After, you must restart apache service.

a2dismod php5.6
a2enmod php7.0
service apache2 restart

2.2.4 Suse

Template warning.png

With older versions of Suse or Opensuse, php7 packages may not be available.

 


To install php 7 and its extensions we will have to use the following command:

sudo zypper install php7 php7-mysql apache2-mod_php7

Once installed, we will have to activate the php7 module and restart the Apache server:

sudo a2enmod php7
sudo systemctl restart apache2

2.2.5 Offline actualization in CentOS

In the case that your environment installed with Pandora FMS ISO does not have internet access or your security policy does not allow you to install a third party repository, we have provided in our official support website (only for Enterprise clients) together with the 729 version packages all the rpms necessary for the php update.

The procedure for this update is as follows:

1.- Download the tar.gz with the RPMs of our support web ( there are rpms compatible with Centos 6 x86, Centos 6 x64 and Centos 7 x64 )

2.- Decompress in any directory the content of tar.gz.

tar xvzf rpm-php7-centos7.tar.gz 

3.- Access the uncompressed directory with the command cd and execute the following command to update the packages:

cd rpm-centos7-php7
rpm -U --force *.rpm

In case you see any notice of incompatibility with the Pandora FMS Console package installed, you should copy the rpm of version 729 into this directory or execute the following command.

rpm -U --force *.rpm --nodeps


Go back to Pandora FMS documentation index