PHP Fatal Error: Uncaught Error - Issue After Updating to PHP 8.1

Hello,

I have updated PHP 7.4 to 8.1 by performing a Ubuntu distro upgrade.
However, I now get a 502 Bad Gateway appear when trying to access my installation via the web GUI.

I have run ./validate.php a couple of times and resolved some of the issues, but I’m stuck on this/these particular errors and am unsure of how to sort these.

Truth be told, I’m not fully Linux savvy, but am able to work most of it out…any help in simple terms would be much appreciated!

looks like you are running an old version of librenms?
if I run validate.php

===========================================

Component Version
LibreNMS 22.10.0-96-g0e9bb0407 (2022-11-08T18:22:37+01:00)

Thank you - I’ve just tried to run ./daily.sh but then I receive a whole load more errors…

Hi Ashley,

I would check to see if there are changes between your current code and the branch, which could be causing trouble. If there are, I’d get rid of the code that you have, and get it fresh, as I don’t know how old your system is (my LibreNMS version is 22, so you seem pretty far behind). As always, I strongly recommend taking a backup + snapshot, since I don’t know your environment and might give bad advice.

Check to see what files, if any, are changed on your system:

$ git status

There may be some. Show the output here.

Check to see what version of code you’re on.

$ git rev-parse HEAD

If your output shows that the code is super old, I can give you more information about how you might force update it.

Thank You,

Please find the outputs of git status below…

as for the git rev-parse HEAD command, it returned the following line…
21192a9cf2a3226e1a06bf69e5688242c5903dfa

@ashleylewisms
Interesting. You’re three years of updates behind.

Please take a backup that includes this server and any database or external dependency on LibreNMS.

Let’s get rid of the local changes that you have (assuming that you didn’t mean to make them). Run:

$ git rm --cached -r .
$ git reset --hard

Then, change to the current code branch and pull the latest code:

$ git checkout master
$ git pull --no-edit --no-ff --allow-unrelated-histories origin master

Then, run your daily.sh script and the validate script. Restart services. Paste any errors from the previous steps here, and assuming that it goes as planned, paste the output of your validate script.

Please tag me in your reply so I get notified.

1 Like

@vps-eric

Thank you so much for your help.

By executing those commands, I’ve now got a fully functional LibreNMS again.
It’s very strange how you said that it’s 3 years out of date…we had it installed back in November 2021 (though that was by a 3rd party company, so perhaps they installed an older build that they just had handy).

Here is the most recent output of ./validate.php - it all looks good except for needing the timezone to be set…

@ashleylewisms

Not sure what that company was thinking. You were up to date… on a branch that stopped being maintained in 2019, for PHP 5.6. That sort of blows me away.

Anyway, the other issue can be resolved by editing that file and putting in your timezone, then restarting php-fpm. Here’s a list of valid options.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.