Using systemctl to see which services are automatically starting up (PHP-FPM issue)

Use systemctl list-unit-files --type=service --state=enabled to get a list of services that will automatically start.

E.g.:

user@server:~$ systemctl list-unit-files --type=service --state=enabled
UNIT FILE STATE VENDOR PRESET
accounts-daemon.service enabled enabled
apparmor.service enabled enabled
...
[email protected] enabled enabled
...
iscsi.service enabled enabled
...
mysql.service enabled enabled
mysqld.service enabled enabled
...
php7.4-fpm.service enabled enabled
php8.1-fpm.service enabled enabled
...
webmin.service enabled enabled

74 unit files listed.

Why we started this exercise is saw on LibreNMS that both 7.4 and 8.1 of PHP-FPM is running and this causes problems as just 8.1 should be running. Next, we do this to fix the problem:

user@server:~$ sudo systemctl disable php7.4-fpm.service
[sudo] password for user:
Synchronizing state of php7.4-fpm.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable php7.4-fpm
Removed /etc/systemd/system/multi-user.target.wants/php7.4-fpm.service.

Next we can start the right FPM:

user@server:~$ /etc/init.d/php8.1-fpm status
● php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2025-01-08 10:21:32 SAST; 2min 0s ago
Docs: man:php-fpm8.1(8)
Main PID: 1769498 (php-fpm8.1)
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 3 (limit: 4594)
Memory: 15.5M
CGroup: /system.slice/php8.1-fpm.service
├─1769498 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)
├─1769506 php-fpm: pool librenms
└─1769507 php-fpm: pool librenms

Jan 08 10:21:32 nms systemd[1]: Starting The PHP 8.1 FastCGI Process Manager...
Jan 08 10:21:32 nms systemd[1]: Started The PHP 8.1 FastCGI Process Manager.

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top