Difference between revisions of "Pandora: Documentation en: PHP 7"

From Pandora FMS Wiki
Jump to: navigation, search
(CentOS)
 
(41 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Instalación y actualización de PHP 7 =
+
[[Pandora:Documentation_en|Go back to Pandora FMS documentation index]]
== Instalación de PHP 7 ==
+
 
 +
 
 +
= Prerequisites =
 +
 
 +
PHP7 installation must be done with rpm/deb/OUM ... from console version 729 or later. Otherwise, Pandora FMS will suffer a dependency conflict since it requires PHP5 for previous versions.
 +
 
 +
{{Tip|In case of updating from 728 to 729, if the PHP7 repository is configured in your system, it will try to install that repository automatically when updating the console.}}
 +
 
 +
{{Tip|Php version 7.2 or later is supported, it requires installing every dependency needed.}}
 +
 
 +
= Installing & updating PHP 7 =
 +
== PHP 7 Installation ==
 
=== CentOS ===
 
=== CentOS ===
En primer lugar, veremos que no existe ninguna versión anterior de php instalada en la máquina mediante el comando de:
+
First, check that there is no previous php version installed in the machine, using the command:
 
  '''php –v'''
 
  '''php –v'''
  
Line 9: Line 20:
 
</center><br><br>
 
</center><br><br>
  
Una vez comprobado que hemos desinstalados correctamente php, nos bajaremos los repositorios de epel y remi con las últimas versiones a instalar:
+
Once verified that php has been uninstalled correctly, download the epel and remi last version repositories to install them:
  
 
  # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
 
  # 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
 
  # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
 +
 +
 +
For CentOS 6 versions, download them 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
 +
 
<center><br><br>
 
<center><br><br>
 
[[image:Epel.png]]
 
[[image:Epel.png]]
Line 20: Line 38:
 
</center><br><br>
 
</center><br><br>
  
A continuación, instalaremos '''yum-utils''' en el caso de que no lo tengamos instalado previamente en nuestra máquina para poder utilizar el comando '''yum-config-manager''':  
+
Next, install '''yum-utils''' in case of not having installed it previously to be able to use the command '''yum-config-manager''':  
 +
 
 +
yum install yum-utils
 
  yum-config-manager --enable remi-php72
 
  yum-config-manager --enable remi-php72
  
Line 27: Line 47:
 
</center><br><br>
 
</center><br><br>
  
Finalmente instalaremos la versión php7.2 en nuestro sistema:  
+
Finally, install version php7.2 on your system:  
  yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-snmp php-mbstring
+
  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
  
 
<center><br><br>
 
<center><br><br>
Line 34: Line 54:
 
</center><br><br>
 
</center><br><br>
  
Y comprobamos finalmente la versión instalada.
+
And check the installed version
  
 
<center><br><br>
 
<center><br><br>
 
[[image:Version_7_php.png]]
 
[[image:Version_7_php.png]]
</center><br><br>
 
 
Para el correcto funcionamiento de Pandora FMS con la versión 7.2 de PHP, necesitaremos añadir unos paquetes de PHP que son:
 
 
yum install php-xmlrpc libkslt php-xml
 
 
<center><br><br>
 
[[image:Librerias_7_php.png]]
 
 
</center><br><br>
 
</center><br><br>
  
 
=== Windows ===
 
=== Windows ===
En primer lugar, debemos de desplazarnos a la siguiente página web: ''https://windows.php.net/download/'' para descargarnos la versión de PHP 7.2 que necesitemos, en nuestro caso nos bajaremos la versión '''VC15 x64 Thread Safe'''.
+
In the first place, go to the ''https://windows.php.net/download/'' website to download the PHP 7.2 version you need. In this case, download version '''VC15 x64 Thread Safe'''.
  
 
<center><br><br>
 
<center><br><br>
Line 55: Line 67:
 
</center><br><br>
 
</center><br><br>
  
Una vez tengamos descargado el zip, lo descomprimiremos en la carpeta '''C:\php'''.
+
Once the zip is downloaded, unzip it in the folder '''C:\php'''.
  
Una vez creada la carpeta, copiaremos el fichero ''php.ini-production'' y lo renombraremos a ''php.ini''.
+
When the folder is created, copy the ''php.ini-production'' file and rename it as  ''php.ini''.
  
Para finalizar, se deberá de cambiar el fichero de ''httpd-php.conf'' y cambiar el ''LoadFile Y LoadModule'' a lo siguiente:
+
To finish off, change the ''httpd-php.conf'' file,  and change the ''LoadFile and LoadModule'' to this:
  
 
<center><br><br>
 
<center><br><br>
Line 65: Line 77:
 
</center><br><br>
 
</center><br><br>
  
 
+
== PHP 7 Update ==
 
 
== Actualización de PHP 7 ==
 
  
 
=== CentOS ===
 
=== CentOS ===
  
En primer lugar, debemos comprobar que tenemos instalada la versión de php que sea, la cual deberemos de desinstalar antes de poder proceder con la instalación de php7:  
+
Download the epel and remi last version repositories to install:
sudo yum remove php-cli mod_php php-common
 
  
<center><br><br>
+
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[[image:removephp.png]]
+
# yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
</center><br><br>
 
  
Comprobamos que hemos removido correctamente php mediante el comando de:
+
For CentOS 6 versions, download them from here:
'''php –v'''
 
  
<center><br><br>
+
# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
[[image:VersionLinuxNada.png]]
+
# yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
</center><br><br>
 
 
 
Una vez comprobado que hemos desinstalados correctamente php, nos bajaremos los repositorios de epel y remi con las últimas versiones a instalar:
 
  
# 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
 
 
<center><br><br>
 
<center><br><br>
 
[[image:Epel.png]]
 
[[image:Epel.png]]
Line 96: Line 98:
 
</center><br><br>
 
</center><br><br>
  
A continuación, instalaremos '''yum-utils''' en el caso de que no lo tengamos instalado previamente en nuestra máquina para poder utilizar el comando '''yum-config-manager''':  
+
Next, install '''yum-utils''' in case it has not been installed previously in your machine to be able to use the '''yum-config-manager''' command:  
 +
 
 +
yum install yum-utils
 
  yum-config-manager --enable remi-php72
 
  yum-config-manager --enable remi-php72
  
Line 103: Line 107:
 
</center><br><br>
 
</center><br><br>
  
Finalmente instalaremos la versión php7.2 en nuestro sistema:  
+
Finally, install the php7.2 version on your system:  
  yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo php-snmp php-mbstring
+
  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
  
 
<center><br><br>
 
<center><br><br>
Line 110: Line 114:
 
</center><br><br>
 
</center><br><br>
  
Y comprobamos finalmente la versión instalada.
+
And check the installed version
  
 
<center><br><br>
 
<center><br><br>
Line 116: Line 120:
 
</center><br><br>
 
</center><br><br>
  
Para el correcto funcionamiento de Pandora FMS con la versión 7.2 de PHP, necesitaremos añadir unos paquetes de PHP que son:
 
  
  yum install php-xmlrpc libkslt php-xml
+
If some version of Pandora FMS is installed in the machine, reinstall the Pandora FMS console for its correct operation, due to the changes of the PHP version, as seen in the following [[Pandora:Documentation_en:Installing#Console_Installation_2|link]].
 +
 
 +
If you see any incompatibility notice with the Pandora FMS Console package installed, copy the rpm of version 729 into this directory or execute the following command:
 +
 
 +
  rpm -U --force *.rpm --nodeps
 +
 
  
<center><br><br>
+
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:
[[image:Librerias_7_php.png]]
 
</center><br><br>
 
  
Si teníamos alguna versión de Pandora FMS instalada en nuestra máquina, deberemos de reinstalar la consola de Pandora FMS para un correcto funcionamiento de la misma, debido a los cambios de versión de PHP, como podemos ver en el siguiente [[Pandora:Documentation_en:Installing#Console_Installation_2|enlace]].
+
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
  
 
=== Windows ===
 
=== Windows ===
En primer lugar, debemos de desplazarnos a la siguiente página web: ''https://windows.php.net/download/'' para descargarnos la versión de PHP 7.2 que necesitemos, en nuestro caso nos bajaremos la versión '''VC15 x64 Thread Safe'''.
+
First, go to the website: ''https://windows.php.net/download/'' to download the PHP 7.2 version needed. In this case, download version '''VC15 x64 Thread Safe'''.
  
 
<center><br><br>
 
<center><br><br>
Line 133: Line 169:
 
</center><br><br>
 
</center><br><br>
  
Una vez tengamos descargado el zip, lo descomprimiremos en una carpeta llamada '''php'''.  
+
Once the zip is downloaded, unzip it in the folder '''C:\php'''.
  
 
<center><br><br>
 
<center><br><br>
Line 139: Line 175:
 
</center><br><br>
 
</center><br><br>
  
A continuación, iremos a la carpeta localizada en '''C:\PandoraFMS\php''', y la renombraremos a '''php_versionActual''' y copiaremos la nueva carpeta php que hemos creado.
+
Next, go to the folder located in '''C:\PandoraFMS\php''', and rename it to '''php_versionActual''' and copy the new php folder you have created.
  
 
<center><br><br>
 
<center><br><br>
Line 145: Line 181:
 
</center><br><br>
 
</center><br><br>
  
Una vez creada la carpeta, copiaremos el fichero ''php.ini-production'' y lo renombraremos a ''php.ini''.
+
When the folder is created, copy the ''php.ini-production'' file and rename it as  ''php.ini''.
 +
 
 +
After finishing this step, copy the ''libsals.dll'' file and replace it with the same file in the Apache folder ''C:\PandoraFMS\Apache\bin''.
  
Tras finalizar este paso, tendremos que copiar el fichero ''libsals.dll'' y reemplazaarlo por el mismo fichero en la carpeta de Apache ''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 required for Pandora FMS to work properly.
  
También será necesaria la instalación de '''Microsoft Visual C++ 2015''': ''https://www.microsoft.com/en-us/download/details.aspx?id=48145'' para el correcto funcionamiento de Pandora FMS.
+
To finish off, change the ''httpd-php.conf'' file,  and change the ''LoadFile and LoadModule'' to:
  
Para finalizar, se deberá de cambiar el fichero de ''httpd-php.conf'' y cambiar el ''LoadFile Y LoadModule'' a lo siguiente:
 
  
 
<center><br><br>
 
<center><br><br>
 
[[image:httpd-php.png]]
 
[[image:httpd-php.png]]
 
</center><br><br>
 
</center><br><br>
 +
 +
=== 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, update to install it:
 +
sudo apt-get update
 +
 +
To make sure that all apache packages have been installed correctly, and to check that apache will be able to run with the new version, run the following command too:
 +
 +
sudo apt-get install php7.2
 +
 +
And do the same for the dependencies left:
 +
 +
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 both php versions are kept, the old php version must be disabled so that the new php7 version can be enabled. Later restart apache service.
 +
 +
a2dismod php5.6
 +
 +
a2enmod php7.0
 +
 +
service apache2 restart
 +
 +
=== Suse ===
 +
 +
{{Warning|With older Suse or Opensuse versions, php7 packages may not be available.}}
 +
 +
To install php7 and its extensions, use the following command:
 +
 +
sudo zypper install php7 php7-mysql apache2-mod_php7
 +
 +
Once installed, activate the php7 module and restart the Apache server:
 +
 +
sudo a2enmod php7
 +
sudo systemctl restart apache2
 +
 +
=== Offline actualization in CentOS ===
 +
In case the environment installed with Pandora FMS ISO does not have internet access or the security policy does not allow to install a third party repository, we have provided all the rpms needed for php update in our official support website (only for Enterprise clients) together with 729 version packages.
 +
 +
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 the content of tar.gz in any directory.
 +
 +
tar xvzf rpm-php7-centos7.tar.gz
 +
 +
3.- Access the uncompressed directory with the cd command and execute the following command to update the packages:
 +
 +
cd rpm-centos7-php7
 +
rpm -U --force *.rpm
 +
 +
In case you see any incompatibility notice with the Pandora FMS Console package installed, copy the rpm of version 729 into this directory or execute the following command.
 +
 +
rpm -U --force *.rpm --nodeps
 +
  
 
[[Pandora:Documentation en|Go back to Pandora FMS documentation index]]
 
[[Pandora:Documentation en|Go back to Pandora FMS documentation index]]

Latest revision as of 11:25, 27 October 2020

Go back to Pandora FMS documentation index


1 Prerequisites

PHP7 installation must be done with rpm/deb/OUM ... from console version 729 or later. Otherwise, Pandora FMS will suffer a dependency conflict since it requires PHP5 for previous versions.

Info.png

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

 


Info.png

Php version 7.2 or later is supported, it requires installing every dependency needed.

 


2 Installing & updating PHP 7

2.1 PHP 7 Installation

2.1.1 CentOS

First, check that there is no previous php version installed in the machine, using the command:

php –v


VersionLinuxNada.png



Once verified that php has been uninstalled correctly, download the epel and remi last version repositories to install them:

# 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, download them 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, install yum-utils in case of not having installed it previously to be able to use the command yum-config-manager:

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


Yum manager.png



Finally, install version php7.2 on your 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 php-xmlrpc libxslt php-xml


Yum Install php.png



And check the installed version



Version 7 php.png



2.1.2 Windows

In the first place, go to the https://windows.php.net/download/ website to download the PHP 7.2 version you need. In this case, download version VC15 x64 Thread Safe.



DescargaPhp7.jpg



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

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

To finish off, 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

Download the epel and remi last version repositories 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, download them 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, install yum-utils in case it has not been installed previously in your machine to be able to use the yum-config-manager command:

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


Yum manager.png



Finally, install the php7.2 version on your 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 php-xmlrpc libxslt php-xml


Yum Install php.png



And check the installed version



Version 7 php.png




If some version of Pandora FMS is installed in the machine, reinstall the Pandora FMS console for its correct operation, due to the changes of the PHP version, as seen in the following link.

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

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


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 = 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, go to the website: https://windows.php.net/download/ to download the PHP 7.2 version needed. In this case, download version VC15 x64 Thread Safe.



DescargaPhp7.jpg



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



DescompilarPhp7.jpg



Next, go to the folder located in C:\PandoraFMS\php, and rename it to php_versionActual and copy the new php folder you have created.



CambioCarpeta.png



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

After finishing this step, copy the libsals.dll file and replace it with 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 required for Pandora FMS to work properly.

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




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, update to install it:

sudo apt-get update

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

sudo apt-get install php7.2

And do the same for the dependencies left:

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 both php versions are kept, the old php version must be disabled so that the new php7 version can be enabled. Later restart apache service.

a2dismod php5.6
a2enmod php7.0
service apache2 restart

2.2.4 Suse

Template warning.png

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

 


To install php7 and its extensions, use the following command:

sudo zypper install php7 php7-mysql apache2-mod_php7

Once installed, activate the php7 module and restart the Apache server:

sudo a2enmod php7
sudo systemctl restart apache2

2.2.5 Offline actualization in CentOS

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

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 the content of tar.gz in any directory.

tar xvzf rpm-php7-centos7.tar.gz 

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

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

In case you see any incompatibility notice with the Pandora FMS Console package installed, 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