How to stop chkservd monitoring Apache PHP-FPM on a LiteSpeed server?
Hello,
Environment:
- cPanel & WHM: 11.110.0.136
- OS: CloudLinux 7.9 (Boris Yegorov)
- Web server: LiteSpeed (lshttpd.service active; PHP served via lsphp)
- alt-php-config 1-69.el7, CageFS 7.6.38
- Apache PHP-FPM: unused — 0 domains have it enabled (grep -rl "php_fpm: 1" /var/cpanel/userdata/ returns nothing)
Goal:
Stop the ~200/day "The service apache_php_fpm appears to be down" emails. The service is genuinely unused (LiteSpeed handles all PHP via lsphp), so I want to disable chkservd monitoring of apache_php_fpm.
The problem in detail:
chkservd runs /usr/local/cpanel/scripts/restartsrv_apache_php_fpm every 5 minutes. That script attempts to start every alt-php-FPM pool, but all pools are configured to bind to the same port:
# grep -rH "^listen " /opt/alt/php*/etc/php-fpm.d/
/opt/alt/php70/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php71/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php72/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php73/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php74/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php80/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php81/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php82/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
/opt/alt/php83/etc/php-fpm.d/www.conf:listen = 127.0.0.1:9000
Only one can bind; alt-php72/73 always fail:
Jul 16 17:03:35 ... php-fpm[26204]: ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
Jul 16 17:03:35 ... php-fpm[26204]: ERROR: FPM initialization failed
chkservd then reports the service down and emails. Fail counter is over 1000:
[XID ...] The "Apache PHP-FPM alt-73" service is down.
[XID ...] The "Apache PHP-FPM alt-72" service is down.
The subprocess "/usr/local/cpanel/scripts/restartsrv_apache_php_fpm" reported error number 29 when it ended.
[fail count:1017] Restarting apache_php_fpm.... [notify:failed service:apache_php_fpm]
What I've tried:
1. The documented API to turn off monitoring fails:
# whmapi1 configureservice service=apache_php_fpm monitored=0
---
metadata:
command: configureservice
reason: Failed to disable monitoring for apache_php_fpm.
result: 0
version: 1
2. enabled=0 similarly rejected.
3. Disabling the systemd units is no help — they were already disabled, and chkservd systemctl starts them on every cycle regardless:
# systemctl is-enabled alt-php72-fpm alt-php73-fpm
disabled
disabled
(chkservd restarts them anyway → fail → email.)
4. apache_php_fpm is not listed in /etc/chkserv.d/chkservd.conf (only cpanel_php_fpm:1, httpd:1, etc.), yet it is still being monitored — it appears to be a default-monitored "core" service via the service definition file /etc/chkserv.d/apache_php_fpm.
5. whmapi1 servicestatus shows:
display_name: PHP-FPM service for Apache
enabled: 1
installed: 1
name: apache_php_fpm
running: 0
Questions:
1. What is the supported way to stop chkservd from monitoring apache_php_fpm when Apache PHP-FPM is unused (LiteSpeed is the web server)? Why does configureservice … monitored=0 return "Failed to disable monitoring"?
2. Is the all-pools-on-port-9000 layout expected from alt-php-config/CloudLinux on a LiteSpeed box, or is it a misconfiguration I should correct (e.g., unique port or unix socket per pool)?
3. Short of a fix, is there an officially supported way to silence just this monitor (e.g., a tweak flag, or a supported chkservd exclude that survives cPanel updates)?
What I don't want to do: manually edit/remove /etc/chkserv.d/apache_php_fpm or hard-edit chkservd.conf, since cPanel may overwrite those on update. I'm looking for the supported path.
Thanks!
-
Hey there! I'm doing some research on this and I'll let you know as soon as I have more details.
0 -
It turns out that this function doesn't seem to work even though it's noted https://api.docs.cpanel.net/specifications/whm.openapi/services/configureservice that the whmapi1 system should be able to handle that.
I've created case CPANEL-54933 to have our developers look into this to see why that isn't working.
So, to answer your specific questions:
1 - This currently doesn't seem to be possible as this is not the intended behavior
2 - This issue is specific to CloudLinux, and you can read more on that here: https://cloudlinux.zendesk.com/hc/en-us/articles/28829619789212-cPanel-port-9000-bind-conflict-across-alt-phpXX-FPM-Email-alerts-The-apache-php-fpm-service-appears-to-be-down
3 - I don't have an officially supported method at this time, no. I'd recommend manual adjustment of those monitoring scripts you mentioned even though they will get overwritten in the future. You could also potentially create an email filter on your client for the time being to just ignore those messages.
0 -
We hit this exact issue on a LiteSpeed/CloudLinux server - same symptoms, same rejected
configureservicecall. Two findings after digging through the cPanel code:1. Monitoring can't be disabled - it's hard-coded.
Cpanel::Chkservd::Manage::get_always_monitored()returns a fixed list (cpsrvd,queueprocd,dnsadmin,apache_php_fpm,cpanellogd) that chkservd always monitors. Even ifapache_php_fpm:0is saved in/etc/chkserv.d/chkservd.conf, it's ignored. So there's no supported way to silence the monitor - but you can fix why it fails.2. The real cause is likely stale domain pool files. The check requires a running FPM master for every PHP version that has at least one
*.confin/opt/cpanel/alt-phpXX/root/etc/php-fpm.d/(note: not/opt/alt/phpXX/etc/php-fpm.d/- different directory). Ours had orphaned pool files left over from when Apache PHP-FPM was briefly enabled for a domain and later disabled - cPanel didn't clean them up, andgrep -rl "php_fpm: 1" /var/cpanel/userdata/was empty for us too. Since chkservd keeps restarting alt-php72/73 on your box, check those two pool directories.The port 9000 collision is just the stock CloudLinux
www.confdefault - harmless until chkservd tries to start two alt-PHP FPM services at once, then only one can bind and the rest fail forever. No need to re-port anything.Fix: confirm nothing references the pools (no
fcgi://refs in vhost config, no connections to 127.0.0.1:9000), then back up and remove the stale pool files and stop the FPM service chkservd spawned:cp -a /opt/cpanel/alt-php72/root/etc/php-fpm.d/DOMAIN.conf /root/backup/rm /opt/cpanel/alt-php72/root/etc/php-fpm.d/DOMAIN.conf # repeat per versionsystemctl stop alt-php72-fpm/usr/local/cpanel/scripts/restartsrv_apache_php_fpm --checkWith no pool files present, the check passes with nothing to assert. Our next chkservd cycle logged
notify:recoveredand the alerts stopped after a month of failures every 5-10 minutes. Rollback is just copying the files back.0
Please sign in to leave a comment.
Comments
3 comments