From 645c9fd029efb41d061ddc0aa53024ef4bdb1703 Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 3 Dec 2025 01:15:04 -0500 Subject: [PATCH] CRITICAL: Fix PHP-FPM pool detection - search by domain name not username MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: - find_fpm_pool_config() only searched for $username.conf - cPanel EA-PHP names pool configs as $domain.conf - Example: pickledperil.com.conf NOT pickledperil.conf - Result: 'No PHP-FPM pools found' error Fix: - Modified find_fpm_pool_config() to try domain-based naming first - Falls back to username-based naming for compatibility - Search order: domain → username - Applies to all control panels (cPanel, Plesk, InterWorx) Impact: - PHP-FPM pools now detected correctly - Memory capacity analysis now works - All pool-based features functional Test: - find_fpm_pool_config('pickledperil', 'pickledperil.com') - Returns: /opt/cpanel/ea-php81/root/etc/php-fpm.d/pickledperil.com.conf --- lib/php-detector.sh | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/php-detector.sh b/lib/php-detector.sh index bac1d1e..ce4ca8f 100644 --- a/lib/php-detector.sh +++ b/lib/php-detector.sh @@ -208,23 +208,38 @@ find_fpm_pool_config() { local pool_config="" - # cPanel EA-PHP pools + # cPanel EA-PHP pools - try domain first, then username if [ -n "$php_version" ]; then + # Try domain-based config first + if [ -n "$domain" ]; then + pool_config="/opt/cpanel/$php_version/root/etc/php-fpm.d/$domain.conf" + [ -f "$pool_config" ] && echo "$pool_config" && return 0 + fi + # Try username-based config pool_config="/opt/cpanel/$php_version/root/etc/php-fpm.d/$username.conf" [ -f "$pool_config" ] && echo "$pool_config" && return 0 fi - # Search all EA-PHP versions + # Search all EA-PHP versions - try domain first, then username + if [ -n "$domain" ]; then + pool_config=$(find /opt/cpanel/ea-php*/root/etc/php-fpm.d/ -name "$domain.conf" 2>/dev/null | head -1) + [ -n "$pool_config" ] && echo "$pool_config" && return 0 + fi + pool_config=$(find /opt/cpanel/ea-php*/root/etc/php-fpm.d/ -name "$username.conf" 2>/dev/null | head -1) [ -n "$pool_config" ] && echo "$pool_config" && return 0 # Plesk pools - pool_config="/etc/php-fpm.d/plesk-php*-fpm/$domain.conf" - [ -f "$pool_config" ] && echo "$pool_config" && return 0 + if [ -n "$domain" ]; then + pool_config="/etc/php-fpm.d/plesk-php*-fpm/$domain.conf" + [ -f "$pool_config" ] && echo "$pool_config" && return 0 + fi # InterWorx pools - pool_config="/home/$username/var/$domain/php-fpm.conf" - [ -f "$pool_config" ] && echo "$pool_config" && return 0 + if [ -n "$domain" ]; then + pool_config="/home/$username/var/$domain/php-fpm.conf" + [ -f "$pool_config" ] && echo "$pool_config" && return 0 + fi return 1 }