Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:documentation:07_technical_annexes:14_php_7 [2021/05/20 20:03]
admscopia
en:documentation:07_technical_annexes:14_php_7 [2023/02/20 16:54] (current)
Line 1: Line 1:
 ====== Installing and updating PHP 7 ====== ====== Installing and updating PHP 7 ======
 +
 {{indexmenu_n>14}} {{indexmenu_n>14}}
  
-[[en:documentation:start|Go back to Pandora FMS documentation index]] +[[:en:documentation:start|Go back to Pandora FMS documentation index]]
  
 ===== Prerequisites ===== ===== Prerequisites =====
  
-PHP7 installation must be done with rpm/deb/OUM ... from console version 729 or laterOtherwise, Pandora FMS will suffer a dependency conflict since it requires PHP5 for previous versions.+Consult about [[:en:documentation:07_technical_annexes:07_backup_and_restore_procedures|backup and recovery procedures before]] doing any installation or upgrade to Pandora FMS. 
 + 
 +<WRAP center round tip 75%> 
 + 
 +PHP 7.2 → For Pandora FMS versions from 729 to 758.
  
-<WRAP center round tip 60%> 
-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. 
 </WRAP> </WRAP>
 +
 +<WRAP center round tip 75%>
 +
 +PHP7.4 → For Pandora FMS versions from 759 to 767.
 +
 +</WRAP>
 +
 +For version 760 (and later) of Pandora FMS visit "[[:en:documentation:07_technical_annexes:18_php_8|Upgrading from PHP 7 to PHP 8]]".
 +
 +===== PHP 7 Installation =====
  
 <WRAP center round tip 60%> <WRAP center round tip 60%>
-Php version 7.2 or later is supported, it requires installing every dependency needed.+ 
 +Run as **root** or use **sudo** for all commands to use. 
 </WRAP> </WRAP>
  
-===== Installing & updating PHP 7 ===== 
-==== PHP 7 Installation ==== 
 === CentOS === === CentOS ===
-First, check that there is no previous php version installed in the machine, using the command: 
  
-  php –v+First, check that there is no previous PHP version installed in the machine, using the command: 
 +<code>
  
-{{ wiki:VersionLinuxNada.png }}+php –v 
 + 
 +</code>
  
-Once verified that php has been uninstalled correctly, download the epel and remi last version repositories to install them:+{{  :wiki:versionlinuxnada.png  }}
  
 +Once verified that php has been uninstalled correctly, download the [[https://www.redhat.com/en/blog/whats-epel-and-how-do-i-use-it|EPEL]] and Remi (repository with the latest versions of PHP 7):
 <code> <code>
 +
  # 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
 +
 </code> </code>
  
-For CentOS 6 versionsdownload them from here:+In order to use the **yum-config-manager** command you must have **yum-utils** installedverify your installation with the following command: 
 +<code> 
 + yum install yum-utils 
 + 
 +</code> 
 + 
 +For install PHP 7.2 version:
  
 <code> <code>
- # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm  +yum-config-manager --enable remi-php72 
- # yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm+
 </code> </code>
  
-{{ wiki:Epel.png }} +For install PHP 7.4 version:
-{{ wiki:Remi.png }}+
  
-Next, install **yum-utils** in case of not having installed it previously to be able to use the command **yum-config-manager**+<code> 
 +yum-config-manager --enable remi-php74 
 + 
 +</code> 
 + 
 +Finally, install the selected PHP version:
  
 <code> <code>
- yum install yum-utils +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-config-manager --enable remi-php72+
 </code> </code>
  
-{{ wiki:Yum_manager.png }}+{{  :wiki:version_7_2_php.png  }}
  
-Finally, install version php7.2 on your system+And check the installed 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+{{  :wiki:version_7_php.png  }}
  
-{{ wiki:Yum_Install_php.png }}+{{  :wiki:version_7_4_php.png  }}
  
-And check the installed version+==== PHP 7 Update ====
  
-{{ wiki:Version_7_php.png }}+<WRAP center round tip 60%>
  
-=== Windows === +Run as **root** or use **sudo** for all commands to use.
-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**.+
  
-{{ wiki:DescargaPhp7.jpg }}+</WRAP>
  
-Once the zip is downloaded, unzip it in the folder **C:\php**.+=== CentOS ===
  
-When the folder is created, copy the //php.ini-production// file and rename it as  //php.ini//.+Check PHP version installed in the machine:
  
-To finish off, change the //httpd-php.conf// file,  and change the //LoadFile and LoadModule// to this:+<code> 
 +php –v
  
-{{ wiki:httpd-php.png }}+</code>
  
-==== PHP 7 Update ==== +{{  :wiki:version_5_4_php.png  }}
-=== CentOS === +
-Download the epel and remi last version repositories to install:+
  
 +Download the [[https://www.redhat.com/en/blog/whats-epel-and-how-do-i-use-it|EPEL]] and Remi (repository with the latest versions of PHP 7):
 <code> <code>
 +
  # 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
 +
 </code> </code>
  
-For CentOS 6 versionsdownload them from here:+In order to use the **yum-config-manager** command you must have **yum-utils** installedverify your installation with the following command: 
 +<code> 
 + yum install yum-utils 
 + 
 +</code> 
 + 
 +For install PHP 7.2 version:
  
 <code> <code>
- # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm  +yum-config-manager --disable 'remi-php*' 
- yum install http://rpms.famillecollet.com/enterprise/remi-release-6.rpm+yum-config-manager --enable remi-php72 
 </code> </code>
  
-{{ wiki:Epel.png }} +For install PHP 7.4 version:
-{{ wiki: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+<code> 
 +yum-config-manager --disable 'remi-php*
 +yum-config-manager --enable remi-php74 
 + 
 +</code> 
 + 
 +Finally, install the selected PHP version:
  
 <code> <code>
- yum install yum-utils +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-config-manager --enable remi-php72+
 </code> </code>
  
-{{ wiki:Yum_manager.png }}+{{  :wiki:version_7_2_php.png  }}
  
-Finally, install the php7.2 version on your system+And check the installed 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+{{  :wiki:version_7_php.png  }}
  
-{{ wiki:Yum_Install_php.png }}+{{  :wiki:version_7_4_php.png  }}
  
-And check the installed version+==== Rocky Linux 8 ====
  
-{{ wiki:Version_7_php.png }}+PHP version by default is PHP 7.2, update to PHP 7.4 with:
  
 +<code>
 +dnf module reset php -y
 +dnf module enable php:7.4
 +dnf update -y
 +
 +</code>
  
-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 [[en:documentation:02_installation:01_installing#Console_Installation_2|link]].+Check new version with ''php -v'':
  
-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:+{{  :wiki:version_7_4_php_rocky_linux_8.png  }}
  
-  rpm -U --force *.rpm --nodeps 
  
 +===== 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: 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:
Line 132: Line 178:
 max_execution_time = 0 max_execution_time = 0
 max_input_time = -1 max_input_time = -1
-memory_limit = 500M+memory_limit = 800M
 error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_USER_WARNING error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_USER_WARNING
 log_errors = On log_errors = On
Line 155: Line 201:
 sendmail_path = /usr/sbin/sendmail -t -i sendmail_path = /usr/sbin/sendmail -t -i
 mail.add_x_header = On mail.add_x_header = On
-</code> 
- 
- 
-=== 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**. 
- 
-{{ wiki:DescargaPhp7.jpg }} 
- 
-Once the zip is downloaded, unzip it in the folder **C:\php**. 
- 
-{{ wiki: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. 
- 
-{{ wiki: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: 
- 
- 
-{{ wiki:httpd-php.png }} 
- 
-=== 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 === 
-<WRAP center round important 60%> 
-With older Suse or Opensuse versions, php7 packages may not be available. 
-</WRAP> 
- 
-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: 
- 
-<code> 
- sudo a2enmod php7 
- sudo systemctl restart apache2 
 </code> </code>
  
-=== Offline actualization in CentOS === +[[:en:documentation:start|Go back to Pandora FMS documentation index]]
-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: +
- +
-<code> +
- cd rpm-centos7-php7 +
- rpm -U --force *.rpm +
-</code> +
- +
-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 +
  
-[[en:documentation:start|Go back to Pandora FMS documentation index]] 
  
ºº