[SOLVED] HTTP 500 with 1.2.20 under PHP 5.4
Moderators: Developers, Moderators
[SOLVED] HTTP 500 with 1.2.20 under PHP 5.4
Hello,
I've been eagerly awaiting the release of 1.2.20 due to some bugs in 1.2.19 that really had my server slowed down. I attempted upgrade via the Documentation, and when browsing to the site again, the redirect to install.php errors out with an error 500. The Apache error log contains:
[Wed Apr 06 13:06:44.695073 2022] [:error] [pid 25116] [client XXX] PHP Parse error: syntax error, unexpected '[' in /var/www/html/cacti/lib/api_device.php on line 1214, referer: http://netops.xxxxxx.com/cacti/install/install.php
That line doesn't appear to contain an extra '[', so it must be coming from something above it, I'd guess... I don't have a lot of programming experience.
In case this was an oddity from the upgrade process, I also tried an install in a fresh directory, updated my httpd conf to point to it, and get exactly the same thing. Has anyone else had any issue with the 1.2.20 release like this?
I've been eagerly awaiting the release of 1.2.20 due to some bugs in 1.2.19 that really had my server slowed down. I attempted upgrade via the Documentation, and when browsing to the site again, the redirect to install.php errors out with an error 500. The Apache error log contains:
[Wed Apr 06 13:06:44.695073 2022] [:error] [pid 25116] [client XXX] PHP Parse error: syntax error, unexpected '[' in /var/www/html/cacti/lib/api_device.php on line 1214, referer: http://netops.xxxxxx.com/cacti/install/install.php
That line doesn't appear to contain an extra '[', so it must be coming from something above it, I'd guess... I don't have a lot of programming experience.
In case this was an oddity from the upgrade process, I also tried an install in a fresh directory, updated my httpd conf to point to it, and get exactly the same thing. Has anyone else had any issue with the 1.2.20 release like this?
Last edited by dtcdan on Fri Apr 08, 2022 8:02 am, edited 1 time in total.
Re: HTTP 500 with 1.2.20
If you have the latest sources, this shouldn't be a problem as I have just checked our sources and there is no issue:
Code: Select all
$ php -l lib/api_device.php
No syntax errors detected in lib/api_device.php
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: HTTP 500 with 1.2.20
Interesting. Here's what I get, when running the same against a fresh extract of the archive cacti-1.2.20.tar.gz
This is on a machine that has PHP 5.4 on it:
I grabbed the code for that file directly out of GitHub with the same results on the same server, but when I did so on a newer server and PHP, I got the same thing you did. Version of working test:
Is is possible that Cacti requires a newer version of PHP than it used to? It seems like syntactically a '[' wouldn't be handled differently by different PHP versions, but that's what the evidence is suggesting. I'll try upgrading PHP on the original server and see if I can get an upgrade to happen.
Code: Select all
[root@netops lib]# php -l api_device.php
PHP Parse error: syntax error, unexpected '[' in api_device.php on line 1214
Errors parsing api_device.php
Code: Select all
[root@netops ~]# php --version
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
Code: Select all
[root@bookstack ~]# php --version
PHP 7.3.31 (cli) (built: Sep 21 2021 10:24:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.31, Copyright (c) 1998-2018 Zend Technologies
Re: [SOLVED] HTTP 500 with 1.2.20
Once I upgraded PHP (to 7.4), this issue went away and I was able to get my instance upgraded.
Re: [SOLVED] HTTP 500 with 1.2.20
Yes, this was confirmed as an issue under PHP 5.4 only. For some reason, the CI system seems not to have reported this to us so that's going to need investigating.
Cacti Developer & Release Manager
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
The Cacti Group
Director
BV IT Solutions Ltd
+--------------------------------------------------------------------------+
Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Re: [SOLVED] HTTP 500 with 1.2.20 under PHP 5.4
Is there a solution to this for PHP 5.4? My system updated to cacti 1.2.20 today and now cacti is broken because of this issue. I'm on centos 7.9 which comes stock with PHP 5.4.
Re: [SOLVED] HTTP 500 with 1.2.20 under PHP 5.4
Aha. It's a simple fix. Line 1214 of /usr/share/cacti/lib/api_device.php is:
} elseif (!$isset(raised[$poller_id])) {
and it should be:
} elseif (!$isset($raised[$poller_id])) {
(add a $ before "raised"). I made this change and the install/upgrade process proceeds past the blank page.
} elseif (!$isset(raised[$poller_id])) {
and it should be:
} elseif (!$isset($raised[$poller_id])) {
(add a $ before "raised"). I made this change and the install/upgrade process proceeds past the blank page.
Re: [SOLVED] HTTP 500 with 1.2.20 under PHP 5.4
i get the same errors.php version is 5.4 too. so i testing....
Re: [SOLVED] HTTP 500 with 1.2.20 under PHP 5.4
it's worked.dvsing wrote: ↑Mon Apr 18, 2022 1:40 pm Aha. It's a simple fix. Line 1214 of /usr/share/cacti/lib/api_device.php is:
} elseif (!$isset(raised[$poller_id])) {
and it should be:
} elseif (!$isset($raised[$poller_id])) {
(add a $ before "raised"). I made this change and the install/upgrade process proceeds past the blank page.
Who is online
Users browsing this forum: No registered users and 6 guests