Subject: [Pkg-cacti-maint] Bug#949385: cacti: Cacti fails under PHP-FPM

From: Adam Thompson <[email-masked]>
Date: Mon, 20 Jan 2020 08:28:06 -0600

Package: cacti
Version: 1.2.2+ds1-2+deb10u2
Severity: grave
Tags: upstream newcomer
Justification: renders package unusable

Dear Maintainer,

   * What led up to the situation?
Switching from Apache2 to Nginx, which mandated switching from mod_php to PHP-FPM.
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
Setting this line in nginx.conf:
fastcgi_catch_stderr "AAABBBCCCDDDEEEFFF"; # try to always pass the crap through, never detect an error
   * What was the outcome of this action?
Cacti at least loads now, but generates a nearly endless series of non-understandable error messages.
   * What outcome did you expect instead?
Cacti to just... work.

The exact error is:
[20-Jan-2020 08:19:02] WARNING: [pool www] child 18496 said into stderr: "NOTICE: PHP message: PHP Notice:  Trying to access array offset on value of type null in /usr/share/cacti/site/lib/functions.php on line 4431"

This looks a lot like https://github.com/Cacti/cacti/issues/3127, I think?
Supposedly this is fixed in 1.2.7 somehow, but even though 1.2.8 is available in testing, I'm still on Buster, and I've seen the package maintainer's comments that installing -testing's version on -stable isn't likel to work at all, so I haven't tried completely breaking my server in that way yet.

Once I convince nginx to pass through error details instead of just dumping me at a "502 bad gateway" error, Cacti looks like it sorta kinda works... but it doesn't actually work.  Every page load gets me a popup with "Sorry, we could not process your last action.  Error: 200  Reason: The response to the last action was unexpeced." and in the logs, another corresponding entry about functions.php:4431.

-- System Information:
Debian Release: 10.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-6-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8), LANGUAGE=en_CA:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cacti depends on:
ii  dbconfig-common                 2.0.11+deb10u1
ii  dbconfig-mysql                  2.0.11+deb10u1
ii  debconf [debconf-2.0]           1.5.71
ii  fonts-dejavu-core               2.37-1
ii  fonts-dejavu-extra              2.37-1
ii  fonts-fork-awesome              1.1.5+ds1-2
ii  javascript-common               11
ii  libapache2-mod-php              2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  libapache2-mod-php7.4 [libapac  7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  libjs-c3                        0.4.11+dfsg-2
ii  libjs-chart.js                  2.7.3+dfsg-5
ii  libjs-d3                        3.5.17-2
ii  libjs-jquery                    3.3.1~dfsg-3
ii  libjs-jquery-colorpicker        1.2.17-1
ii  libjs-jquery-cookie             12-1.1
ii  libjs-jquery-hotkeys            0~20130707+git2d51e3a9+dfsg-2
ii  libjs-jquery-jstree             3.3.7+dfsg1-1
ii  libjs-jquery-metadata           12-1.1
ii  libjs-jquery-tablesorter        1:2.31.1+dfsg1-1
ii  libjs-jquery-timepicker         1.2-1
ii  libjs-jquery-ui                 1.12.1+dfsg-5
ii  libjs-jquery-ui-theme-smoothne  1.12.1+dfsg-1
ii  libjs-jquery-ui-theme-south-st  1.12.1+dfsg-1
ii  libjs-jquery-ui-theme-ui-darkn  1.12.1+dfsg-1
ii  libjs-jquery-ui-touch-punch     0.0~git20141218.2.4bc0091+dfsg1-2
ii  libphp-phpmailer                6.0.6-0.1
ii  perl                            5.28.1-6
ii  php-gd                          2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  php-gmp                         2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  php-ldap                        2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  php-mbstring                    2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  php-mysql                       2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  php-php-gettext                 1.0.12-0.1
ii  php-phpseclib                   2.0.14-1
ii  php-snmp                        2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  php-twig                        2.6.2-2
ii  php-xml                         2:7.4+71+0~20191219.19+debian10~1.gbpefc769
ii  php7.4-cli [php-cli]            7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  php7.4-gd [php-gd]              7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  php7.4-gmp [php-gmp]            7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  php7.4-json [php-json]          7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  php7.4-ldap [php-ldap]          7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  php7.4-mbstring [php-mbstring]  7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  php7.4-snmp [php-snmp]          7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  php7.4-xml [php-xml]            7.4.1-1+0~20191218.8+debian10~1.gbp21c50e
ii  rrdtool                         1.7.1-2
ii  snmp                            5.7.3+dfsg-5
ii  ucf                             3.0038+nmu1

Versions of packages cacti recommends:
ii  apache2 [httpd]                             2.4.38-3+deb10u3
ii  default-mysql-server                        1.0.5
ii  iputils-ping                                3:20180629-2
ii  logrotate                                   3.14.0-4
ii  mariadb-server-10.3 [virtual-mysql-server]  1:10.3.18-0+deb10u1
ii  nginx [httpd]                               1.16.1-1~buster

Versions of packages cacti suggests:
pn  cacti-spine  <none>
ii  moreutils    0.62-1
ii  snmpd        5.7.3+dfsg-5

-- debconf information:
  cacti/app-password-confirm: (password omitted)
  cacti/password-confirm: (password omitted)
  cacti/mysql/admin-pass: (password omitted)
  cacti/mysql/app-pass: (password omitted)
  cacti/remote/port:
  cacti/install-error: abort
* cacti/dbconfig-upgrade: true
* cacti/db/dbname: cacti
* cacti/webserver: apache2
  cacti/missing-db-package-error: abort
  cacti/remote/newhost:
  cacti/dbconfig-remove:
  cacti/remove-error: abort
  cacti/dbconfig-install: true
  cacti/database-type: mysql
  cacti/purge: false
* cacti/mysql/method: Unix socket
* cacti/upgrade-backup: true
* cacti/passwords-do-not-match:
  cacti/upgrade-error: retry
  cacti/internal/reconfiguring: false
* cacti/db/app-user: cacti_muug@localhost
  cacti/internal/skip-preseed: false
* cacti/mysql/admin-user: debian-sys-maint
  cacti/dbconfig-reinstall: false
  cacti/remote/host: localhost

---

From: Paul Gevers <[email-masked]>
Date: Mon, 20 Jan 2020 20:29:37 +0100

Control: tags -1 moreinfo

Hi Adam,

Thanks for reporting issues you encounter.

> Switching from Apache2 to Nginx, which mandated switching from mod_php to PHP-FPM.

In the cacti bug, you said that you upgraded php to 7.4. Is there any
particular reason why you need that? buster is released with 7.3 as
default php and 7.4 isn't available except for experimental. So having a
bug about cacti not working correctly with an upstream unsupported php
version is a bit weird and doesn't sound "grave".

If there is good reason to want later versions of cacti in buster, such
as php 7.4 support if 7.4 has killing features, I am willing to consider
providing a backport.

Paul

---

From: "Debian Bug Tracking System" <[email-masked]>
Date: Mon, 20 Jan 2020 19:33:21 +0000

Processing control commands:

> tags -1 moreinfo
Bug #949385 [cacti] cacti: Cacti fails under PHP-FPM
Added tag(s) moreinfo.

-- 
949385: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=949385
Debian Bug Tracking System
Contact [email-masked] with problems

---

From: Adam Thompson <[email-masked]>
Date: Thu, 30 Jan 2020 21:15:27 -0600

The reason we’re running php-7.4 is because I screwed up; I enabled the entire backports repo instead of selecting individual packages from it.
Given that this is the Nth time I’ve done this or seen it done, I suspect it’s a reasonably common scenario/mistake.
-Adam

---

From: Paul Gevers <[email-masked]>
Date: Fri, 31 Jan 2020 09:30:08 +0100

Control: severity -1 normal
Control: retitle -1 cacti doesn't work with php-7.4

Hi Adam,
On 31-01-2020 04:15, Adam Thompson wrote:
> The reason we’re running php-7.4 is because I screwed up; I enabled the entire backports repo instead of selecting individual packages from it

I still don't understand. php-7.4 is not available in the backports
repo. It's not even allowed there as php-7.4 is not in testing.

Paul

---

From: "Debian Bug Tracking System" <[email-masked]>
Date: Fri, 31 Jan 2020 08:33:06 +0000

Processing control commands:

> severity -1 normal
Bug #949385 [cacti] cacti: Cacti fails under PHP-FPM
Severity set to 'normal' from 'grave'
> retitle -1 cacti doesn't work with php-7.4
Bug #949385 [cacti] cacti: Cacti fails under PHP-FPM
Changed Bug title to 'cacti doesn't work with php-7.4' from 'cacti: Cacti fails under PHP-FPM'.

---

From: "Debian Bug Tracking System" <[email-masked]>
Date: Fri, 06 Nov 2020 20:57:03 +0000

Your message dated Fri, 6 Nov 2020 21:55:13 +0100
with message-id <[email-masked]>
and subject line Re: Bug#949385: cacti: Cacti fails under PHP-FPM
has caused the Debian Bug report #949385,
regarding cacti doesn't work with php-7.4
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email-masked]
immediately.)

Subject: cacti: Cacti fails under PHP-FPM
From: Adam Thompson <[email-masked]>
To: Debian Bug Tracking System <[email-masked]>
Date: Mon, 20 Jan 2020 08:28:06 -0600

Package: cacti

Dear Maintainer,

The exact error is:

-- System Information:
Debian Release: 10.2
  APT prefers stable

-- debconf information:

Subject: Re: Bug#949385: cacti: Cacti fails under PHP-FPM
From: Paul Gevers <[email-masked]>
To: Adam Thompson <[email-masked]>, [email-masked]
Date: Fri, 6 Nov 2020 21:55:13 +0100

Version: 1.2.12+dfsg-1

Hi Adam,

> Control: retitle -1 cacti doesn't work with php-7.4

This is fixed in upstream release 1.2.12. php-7.4 is the default in
Debian now and I'm not seeing issues, hence, closing this bug

Paul