PostProcess Issue after 11.7.4 update

Hi everyone, I came from 11.6.9 tag, now after 11.7.4 there is an issues as Postprocess’ link is not working anymore, it gives me this message:

Parse error: syntax error, unexpected ':', expecting ')' in /opt/emoncms/modules/postprocess/common.php on line 170

I’m running emonSD-21Jul21

Yeah, this has been happening for a little while, ref my post from earlier in the year: PHP error when opening Post Process in emoncms

I added an issue on the GitHub page as well: PHP error when opening Post Process module · Issue #36 · emoncms/postprocess · GitHub

I use postprocess everyday and this is the first time for me that I see that message. I’ve always kept the system up to date so it’s something related to latest built (at least for me). I hope they fix it soon as I need to access to that tab.

@TrystanLea ?

Thanks, this is unfortunately a php version issue, the new code is using syntax that is not compatible with pre v8 versions of php. While I was aware of this from inspecting the code a few months back I totally forgot about it with this merge to stable.

The fastest way to get back to a working version is probably to roll back to the previous version of the post process module, this can be done via SSH with the following:

cd /opt/emoncms/modules/postprocess
git checkout 2.4.7

Looks like I need to either add a PHP upgrade (and all associated PHP modules) to the update process or modify the code to provide backwards compatibility. I will work out what is best to do.

1 Like

I feel a major refactoring task is looming.

In which direction? php7.4 compatibility or php upgrade path? :sweat_smile:

1 Like

I’d suggest it needs to go for full compatibility with the latest stable versions. We’ve a fair few workarounds in the installation currently (IIRC). Moving to 64bit may throw up more.

Where are we on this?

I updated my local installation a few weeks back and now hit this error too.

Hello @greentangerine I had not quite appreciated when I posted the above that the last three emonSD image releases all support PHP 8+ (emonSD-01Feb24, emonSD-20Nov23 & emonSD-10Nov22). We have to go back to emonSD-21Jul21 or earlier for older versions of PHP.

Option 1: The best solution would be to download the most recent release and to then use the “Import using an USB SD card reader” to restore your system Import / Backup / Restore / Update — OpenEnergyMonitor 0.0.1 documentation .

Option 2: I’ve just generated a script using a combination of Google Gemini and Claude that will update PHP on a RaspberryPi system running an older version. I’ve tested this on the latest image that I had on hand here and it successfully updates PHP from 8.1 to 8.3 with the Emoncms installation continuing to run as expected. This script can be ran following these steps via SSH:

cd /opt/openenergymonitor/EmonScripts
git checkout master
git pull origin master
cd update/test
sudo ./update_php.sh

It takes a while and prints a lot of info as there are a lot of related modules that get updated including building the php redis and mosquitto client from source. The source code for this update script can be reviewed here EmonScripts/update/test/update_php.sh at master · openenergymonitor/EmonScripts · GitHub

Option 3: Revert to an older version of the postprocess module:

cd /opt/emoncms/modules/postprocess
git checkout 2.4.7

It failed with …

Reading package lists… Done
– Not ARMv6 architecture. Targeting PHP 8.3.
— Adding Sury repository for PHP 8.3 —
— Detected OS codename: buster
Adding Sury GPG Key…
Adding Sury repository source file…
Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Err:3 https://packages.sury.org/php buster InRelease
418 I’m a teapot [IP: 151.101.3.52 443]
Reading package lists… Done
E: Failed to fetch https://packages.sury.org/php/dists/buster/InRelease 418 I’m a teapot [IP: 151.101.3.52 443]
E: The repository ‘https://packages.sury.org/php buster InRelease’ is not signed.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Is that the full response from the first line? no apt-get update of sources?

## pi@emonpi:/opt/openenergymonitor/EmonScripts/update/test $ sudo ./update_php.sh

## Install Latest PHP Version and Extensions

Hit:1 Index of /debian buster InRelease
Hit:2 Index of /raspbian buster InRelease
Err:3 https://packages.sury.org/php buster InRelease
418 I’m a teapot [IP: 151.101.3.52 443]
Reading package lists… Done
E: Failed to fetch https://packages.sury.org/php/dists/buster/InRelease 418 I’m a teapot [IP: 151.101.3.52 443]
E: The repository ‘https://packages.sury.org/php buster InRelease’ is not signed.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
pi@emonpi:/opt/openenergymonitor/EmonScripts/update/test $

Looks like the issue is that https://packages.sury.org/php/dists/ only supports newer debian versions not buster and so responds randomly with “418 I’m a teapot” :grinning_face_with_smiling_eyes: Looks like updating to 8+ is not going to work on older OS versions which leaves us with option 1 and 3..

I’m on the old radio format and have no desire to have to change lots of THs etc.
Does the new SD card/release impact that?