Issue
Restarting Apache PHP-FPM via /scripts/restartsrv_apache_php_fpm fails because multiple Alt-PHP FPM services (e.g., 7.0–8.4) are configured to listen on the same TCP socket (127.0.0.1:9000), causing Address already in use (98) and FPM initialization failure for all but one version.
ERROR: unable to bind listening socket for address '127.0.0.1:9000':
Address already in use (98)
ERROR: FPM initialization failedAnd cPanel generates recurring failure email notifications with the subject "FAILED ⛔: apache_php_fpm".
The “apache_php_fpm” service appears to be down. Server: host Primary IP Address: %IP Service Name: apache_php_fpm Service Status: Failed ⛔ Notification: The “apache_php_fpm” service appears to be down. Number of Restart Attempts: 1 Raw Output of Service Check (XID q9tcx5): The “Apache PHP-FPM alt-XX” service is down. The “Apache PHP-FPM alt-XX” service is down. The subprocess “/usr/local/cpanel/scripts/restartsrv_apache_php_fpm” reported error number 29 upon completion.
Environment
- CloudLinux OS 8 / 9 (and standalone/Debian-like installs)
- cPanel/WHM, Plesk, or no panel
- Multiple Alt-PHP versions installed with FPM enabled
Solution
Recommended: update to the fixed Alt-PHP packages.
The fix makes each version's default pool listen on its own unix socket (/var/run/alt-phpXY-fpm.sock) and uses nogroup on Debian-like OSes.
Update alt-php and restart the service
yum update 'alt-php*' /scripts/restartsrv_apache_php_fpm
If the update above does not offer the corrected build yet, it has not reached the stable repository on your server. While it is still promoting, pull it from the testing repository explicitly:
yum update --enablerepo=cloudlinux-updates-testing 'alt-php*' /scripts/restartsrv_apache_php_fpm
Once the build has fully promoted to the stable repository, the plain
yum update 'alt-php*'is enough and the--enablerepoflag is no longer needed.Important:
www.confis a protected config file. If it already exists withlisten = 127.0.0.1:9000, the update will not overwrite it — the corrected file is saved aswww.conf.rpmnew. You must adopt the new config for the fix to take effect (next step).For each affected version, apply the corrected pool config — either replace with the packaged version:
# review first, then adopt diff /opt/alt/php73/etc/php-fpm.d/www.conf{,.rpmnew} mv /opt/alt/php73/etc/php-fpm.d/www.conf.rpmnew /opt/alt/php73/etc/php-fpm.d/www.conf…or edit in place so each version uses a unique socket:
sed -i 's@^listen = 127.0.0.1:9000@listen = /var/run/alt-php73-fpm.sock@' \ /opt/alt/php73/etc/php-fpm.d/www.confClear failed unit state and restart:
mkdir -p /root/alt-php-fpm-pool-backup mv /opt/alt/php*/etc/php-fpm.d/www.conf /root/alt-php-fpm-pool-backup/ systemctl reset-failed /scripts/restartsrv_apache_php_fpm
Alternative workaround: disable the default pool
If you don't use the default www pool (e.g. panel-managed per-domain pools handle traffic), move it out of the way so the services stop binding port 9000:
mkdir -p /root/alt-php-fpm-pool-backup mv /opt/alt/php*/etc/php-fpm.d/www.conf /root/alt-php-fpm-pool-backup/ systemctl reset-failed /scripts/restartsrv_apache_php_fpm
Comments
0 comments
Please sign in to leave a comment.