Preparation
As always, to upgrade to current PHP version you would need Ondrej’s package. But you may skip this step if it’s already installed.
add-apt-repository ppa:ondrej/php
Note: Before and after the upgrade, this is a good command sequence to use:
- ssh to server
- sudo as root
- sudo – librenms
- /opt/librenms/validate.php
The above script will check a whole bunch of things.
The most import and slightly complex part of the upgrade is getting the new PHP FPM working. To test the FPM, use this command:
php-fpm8.3 -t
When you’re done, there is some purging to do. We highly recommend those steps too.
Upgrade sequence after prep
Here is the sequence to upgrade from 8.1 to 8.3.
- sudo -i
- apt install php8.3-{fpm,cli,opcache,common,curl,mysql,sqlite3,xml,zip,gd,bcmath,intl,mbstring,readline}
- mv /etc/php/8.3/fpm/pool.d/www.conf /etc/php/8.3/fpm/pool.d/librenms.conf
- Make these changes in that file:
- mc -e /etc/php/8.3/fpm/pool.d/librenms.conf
- [www] => [librenms]
- user = www-data => user = librenms
- group = www-data => group = librenms
In /etc/nginx/conf.d/librenms.conf we are using these lines:
mc -e /etc/nginx/conf.d/librenms.conf
location ~ [^/]\.php(/|$) {
#fastcgi_pass unix:/run/php-fpm-librenms.sock;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
}
The suggestion from the forum link below is to reboot but I don’t think it’s needed.
Fix the time zone in both FPM and CLI:
- mc -e /etc/php/8.3/fpm/php.ini
- mc -e /etc/php/8.3/cli/php.ini
Find date.timezone and change it.
service php8.3-fpm start /opt/librenms/validate
Cleanup
When done:
apt purge php8.1-cli
After purging, check /etc/php/8.x/
if it’s still around.
If you haven’t purged, you might have to do this on some legacy systems:
systemctl disable php8.1-fpm
Possible Issues
Check status:
php-fpm8.3 -t
Here is one problem where the old configuration file was still there and had to be removed:
php-fpm8.3 -t [09-Jan-2025 08:31:20] ERROR: [pool www] unable to set listen address as it's already used in another pool 'librenms' [09-Jan-2025 08:31:20] ERROR: failed to post process the configuration [09-Jan-2025 08:31:20] ERROR: FPM initialization failed
Here is what it showed also (but impossible to troubleshoot):
service php8.3-fpm status ● php8.3-fpm.service - The PHP 8.3 FastCGI Process Manager Loaded: loaded (/lib/systemd/system/php8.3-fpm.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2025-01-09 08:29:46 SAST; 17s ago Docs: man:php-fpm8.3(8) Process: 1131 ExecStart=/usr/sbin/php-fpm8.3 --nodaemonize --fpm-config /etc/php/8.3/fpm/php-fpm.conf (code=exited, status=78) Process: 1136 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/8.3/fpm/pool.d/www.conf 83 (code=exited, status=0/> Main PID: 1131 (code=exited, status=78)
How I found ./validate as per community notes:
apt install mlocate
wait for the database to be made.
Then I could do this:
/opt/librenms/validate.php
Do not run validate.php as root
- sudo -i
- su – librenms
Sampe Validate Fails
[FAIL] Python3 module issue found: 'Required packages: ['PyMySQL!=1.0.0', 'python-dotenv', 'redis>=4.0', 'setuptools', 'psutil>=5.6.0', 'command_runner>=1.3.0'] Package not found: The 'command_runner>=1.3.0' distribution was not found and is required by the application ' [FIX]: pip3 install -r /opt/librenms/requirements.txt
Then try it as the librenms
user:
librenms@nms:~$ pip3 install -r /opt/librenms/requirements.txt Command 'pip3' not found, but can be installed with: apt install python3-pip Please ask your administrator.
Next as a sudo user,
apt install python3-pip
This is a huge installation
Then this worked (again, as librenms
):
librenms@nms:~$ pip3 install -r /opt/librenms/requirements.txt
See the community notes for more ideas:
https://community.librenms.org/t/step-by-step-procedure-to-update-to-latest-php-8-3-11/26159/14