Issues after recent PHP version updates

First check logs librenms.log, daily.log, and webserver/php logs. And run ./validate.php after applying any of the following fixes.

Errors and fixes:

Problem 1

PHP Parse error:  syntax error, unexpected '=' in /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Arr.php on line 388

Explanation

Your web server is running an old version of PHP.

Fix

Resolutions steps may vary, but here are some suggestions:
Restart apache or php-fpm may fix it.

For apache users, you may need a2dismod php7.0 then a2enmod php7.2 then systemctl restart apache2 (for debian based os). Or you didn’t install the apache2 module apt install libapache2-mod-php7.2

For nginx users, you may need apt-get install php7.2-fpm, update /etc/nginx/conf.d/librenms.conf to point to the new php-fpm socket, and systemctl restart nginx

Problem 2

"PHP Fatal error:  require(): Failed opening required '/opt/librenms/vendor/composer/../symfony/polyfill-php70/bootstrap.php' (include_path='.:/usr/share/php') in /opt/librenms/vendor/composer/autoload_real.php on line 66"

Explanation

You don’t have all the php requirements installed, most notably php7.2-zip (or whatever the package name is for your distro).

Fix

You find them in the install docs. https://docs.librenms.org/Installation/
After installing those, run ./daily.sh again.

Problem 3

Updating to latest codebase                        FAIL
error: Your local changes to the following files would be overwritten by merge:

Explanation

You had some modified LibreNMS system files that conflicted with the update. If you don’t have any changes you care about, we can remove them all so the update can procede. (This does NOT include config.php, that file is safe)

Fix

./scripts/github-remove -d
rm config/hashing.php config/logging.php config/tinker.php  (Warning future visitors, this step may not be needed, check ./daily.sh output first)
./daily.sh

Problem 4

Could not connect to database, check logs/librenms.log.

Explanation

You don’t have all the php requirements installed, most notably php7.2-mysql or php72w-mysqlnd (or whatever the package name is for your distro). Or simply your database server isn’t running and reachable.

Fix

You find them in the install docs. https://docs.librenms.org/Installation/
After installing those, run ./daily.sh again.

Final check

If none of these help you, run ./scripts/composer_wrapper.php install --no-dev and check the output for errors. It may point you in the right direction. You can come ask for help on Discord too.

1 Like

Thanks for the article. Had an issue with the daily update this morning and this article helped a lot. (Problem 3 - though I’m not sure how it happened!)
I got an email at ~1am from Libre saying it had an error during updating. Specifically: “error: unable to create file storage/framework/cache/data/.gitignore (Permission denied)”
After this it was a bit broken. The fix for Problem 3 fixed it (as well as re-applying the selinux permissions from the install process).

minor typo in Problem 3 Fix…
./scripts/gitbhub-remove -d
probably should be “./scripts/github-remove -d”

1 Like

Thank you very much! This was exactly what I needed