problems updating to debian12 with php8.2

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
mcultura
Posts: 4
Joined: Tue Mar 26, 2019 4:12 am

problems updating to debian12 with php8.2

Post by mcultura »

Recently, we tried to update nagiosxi from debian11 with PHP7.4 to debian12 with PHP8.2 via backup and restore.

We updated to the last version 2024R1.3 on debian11 and fresh install on debian12, but after the restore nagios response a HTTP500 every time.

Are those version supported?
sgardil
Posts: 355
Joined: Wed Aug 09, 2023 9:58 am

Re: problems updating to debian12 with php8.2

Post by sgardil »

mcultura wrote: Mon Nov 11, 2024 10:58 am Recently, we tried to update nagiosxi from debian11 with PHP7.4 to debian12 with PHP8.2 via backup and restore.

We updated to the last version 2024R1.3 on debian11 and fresh install on debian12, but after the restore nagios response a HTTP500 every time.

Are those version supported?
Hey @mcultura

Those distros are supported and we added support for debian12 in 2024R1.3 so it should work. The migration process can be pretty finicky. Did you happen to follow our documentation on the process? If not could you revert to a snapshot and try running through the process again with the steps in the doc? I'll provide the doc below. Also could you check your php logs to see if anything is in there that may give us more to go off of. They should be located in

Code: Select all

/var/log/apache2/

https://assets.nagios.com/downloads/nag ... I-2024.pdf
mcultura
Posts: 4
Joined: Tue Mar 26, 2019 4:12 am

Re: problems updating to debian12 with php8.2

Post by mcultura »

Those are the logs today during restore and after

access.log

Code: Select all

nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:15:42 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 200 778 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:16:42 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 200 778 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:16:42 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 200 872 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:16:42 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=keepalive&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 200 511 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:17:11 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 403 492 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:17:11 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=keepalive&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 403 492 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:17:11 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 403 492 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:17:41 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 500 185 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:17:41 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_tray_alert_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 500 185 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:18:11 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=getxicoreajax&opts=%7B%22func%22%3A%22get_pagetop_alert_content_html%22%2C%22args%22%3A%22%22%7D&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 500 185 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"
nagios.lab.es:80 192.168.1.17 - - [12/Nov/2024:09:18:11 +0100] "GET /nagiosxi/ajaxhelper.php?cmd=keepalive&nsp=864a5c5253161068b487549ff2ffded9bd506b7cee138a77709898f69eeb9820 HTTP/1.1" 500 185 "http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36"

error.log

Code: Select all

[Tue Nov 12 00:00:08.367140 2024] [core:notice] [pid 144254:tid 144254] AH00094: Command line: '/usr/sbin/apache2'
[Tue Nov 12 09:17:11.543518 2024] [core:error] [pid 210753:tid 210753] (13)Permission denied: [client 192.168.1.17:58639] AH00035: access to /nagiosxi/ajaxhelper.php denied (filesystem path '/usr/local/nagiosxi/html') because search permissions are missing on a component of the path, referer: http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php
[Tue Nov 12 09:17:11.795289 2024] [core:error] [pid 243503:tid 243503] (13)Permission denied: [client 192.168.1.17:58638] AH00035: access to /nagiosxi/ajaxhelper.php denied (filesystem path '/usr/local/nagiosxi/html') because search permissions are missing on a component of the path, referer: http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php
[Tue Nov 12 09:17:11.795302 2024] [core:error] [pid 243420:tid 243420] (13)Permission denied: [client 192.168.1.17:58640] AH00035: access to /nagiosxi/ajaxhelper.php denied (filesystem path '/usr/local/nagiosxi/html') because search permissions are missing on a component of the path, referer: http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php
[Tue Nov 12 09:17:41.647606 2024] [php:error] [pid 243533:tid 243533] [client 192.168.1.17:58650] PHP Fatal error:  SourceGuardian Loader - This protected script was not encoded for version 8.2.24 of PHP. Please re-encode or contact the author of the script regarding this problem. Error code [07] in /usr/local/nagiosxi/html/includes/dbl.inc.php on line 2, referer: http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php
[Tue Nov 12 09:17:41.646426 2024] [php:error] [pid 243357:tid 243357] [client 192.168.1.17:58651] PHP Fatal error:  SourceGuardian Loader - This protected script was not encoded for version 8.2.24 of PHP. Please re-encode or contact the author of the script regarding this problem. Error code [07] in /usr/local/nagiosxi/html/includes/dbl.inc.php on line 2, referer: http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php
[Tue Nov 12 09:18:11.121765 2024] [php:error] [pid 242708:tid 242708] [client 192.168.1.17:58659] PHP Fatal error:  SourceGuardian Loader - This protected script was not encoded for version 8.2.24 of PHP. Please re-encode or contact the author of the script regarding this problem. Error code [07] in /usr/local/nagiosxi/html/includes/dbl.inc.php on line 2, referer: http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php
[Tue Nov 12 09:18:11.514863 2024] [php:error] [pid 243101:tid 243101] [client 192.168.1.17:58658] PHP Fatal error:  SourceGuardian Loader - This protected script was not encoded for version 8.2.24 of PHP. Please re-encode or contact the author of the script regarding this problem. Error code [07] in /usr/local/nagiosxi/html/includes/dbl.inc.php on line 2, referer: http://nagios.lab.es/nagiosxi/includes/components/ccm/xi-index.php
Searching for this error:
PHP Fatal error: SourceGuardian Loader
I followed this guide:
https://support.nagios.com/kb/article/n ... s-816.html

But it didnt worked
jsimon
Posts: 343
Joined: Wed Aug 23, 2023 11:27 am

Re: problems updating to debian12 with php8.2

Post by jsimon »

Hi @mcultura,

Looking at the debian 12 info you listed as well as the error logs, it looks to me like the version of PHP is the culprit here. Your error logs contain the following:

Code: Select all

SourceGuardian Loader - This protected script was not encoded for version 8.2.24 of PHP
I would suggest downgrading the PHP version on your Debian 12 server to PHP 7.4 and retrying the restore process.
User avatar
jmichaelson
Posts: 383
Joined: Wed Aug 23, 2023 1:02 pm

Re: problems updating to debian12 with php8.2

Post by jmichaelson »

Rather than downgrade PHP, can you share the contents of /etc/php/8.2/spache2/conf.d/sourceguardian.ini? I'm wondering if it didn't get updated, or if it got restored accidentally as a part of your migration.

it should say:

Code: Select all

extension=ixed.8.2.lin
Please let us know if you have any other questions or concerns.

-Jason
mcultura
Posts: 4
Joined: Tue Mar 26, 2019 4:12 am

Re: problems updating to debian12 with php8.2

Post by mcultura »

The content of the file:

# cat /etc/php/8.2/apache2/conf.d/sourceguardian.ini
extension=ixed.8.2.lin

Maybe the file/usr/local/nagiosxi/html/includes/dbl.inc.php is not encoded to support this version?
On a fresh install it works, starts to fail when the restore finish.

On the other hand I try to update the fail instalation with the new version and the upgrade process fail with the same error.
User avatar
jmichaelson
Posts: 383
Joined: Wed Aug 23, 2023 1:02 pm

Re: problems updating to debian12 with php8.2

Post by jmichaelson »

what is the timestamp on the file after restore compared to the one where you untarred the xi.....tar.gz file? are they the same size?
Please let us know if you have any other questions or concerns.

-Jason
mcultura
Posts: 4
Joined: Tue Mar 26, 2019 4:12 am

Re: problems updating to debian12 with php8.2

Post by mcultura »

We've replicate the whole process with the new version 1.3.1.
Backup and restore in the new version.

We had to change the backup script because the version of mariadb:

Code: Select all

# Some versions of mysqldump don't have to column statistics option
if mysqldump --column-statistics=0 --version &>/dev/null; then
    #column_option="--column-statistics=0"
    column_option=""
else
    column_option=""
fi

mysqldump $column_option -h "$ndoutils_dbserver" --port="$ndoutils_dbport" -u $cfg__db_info__ndoutils__user --password="$cfg__db_info__ndoutils__pwd" --add-drop-database -B $cfg__db_info__ndoutils__db | tail +2 > $mydir/mysql/nagios.sql
mysqldump $column_option -h "$nagiosql_dbserver" --port="$nagiosql_dbport" -u $cfg__db_info__nagiosql__user --password="$cfg__db_info__nagiosql__pwd" --add-drop-database -B $cfg__db_info__nagiosql__db  | tail +2 > $mydir/mysql/nagiosql.sql
    mysqldump $column_option -h "$nagiosxi_dbserver" --port="$nagiosxi_dbport" -u $cfg__db_info__nagiosxi__user --password="$cfg__db_info__nagiosxi__pwd" --add-drop-database -B $cfg__db_info__nagiosxi__db  | tail +2 > $mydir/mysql/nagiosxi.sql
Thansk for the help, everything works now
User avatar
jmichaelson
Posts: 383
Joined: Wed Aug 23, 2023 1:02 pm

Re: problems updating to debian12 with php8.2

Post by jmichaelson »

Thanks for that. I'll close this thread and investigate adding the tail +2 to the backup script.
Please let us know if you have any other questions or concerns.

-Jason
Post Reply