CRITICAL: Fix PHP-FPM pool detection - search by domain name not username
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
This commit is contained in:
+17
-2
@@ -208,23 +208,38 @@ find_fpm_pool_config() {
|
|||||||
|
|
||||||
local pool_config=""
|
local pool_config=""
|
||||||
|
|
||||||
# cPanel EA-PHP pools
|
# cPanel EA-PHP pools - try domain first, then username
|
||||||
if [ -n "$php_version" ]; then
|
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"
|
pool_config="/opt/cpanel/$php_version/root/etc/php-fpm.d/$username.conf"
|
||||||
[ -f "$pool_config" ] && echo "$pool_config" && return 0
|
[ -f "$pool_config" ] && echo "$pool_config" && return 0
|
||||||
fi
|
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)
|
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
|
[ -n "$pool_config" ] && echo "$pool_config" && return 0
|
||||||
|
|
||||||
# Plesk pools
|
# Plesk pools
|
||||||
|
if [ -n "$domain" ]; then
|
||||||
pool_config="/etc/php-fpm.d/plesk-php*-fpm/$domain.conf"
|
pool_config="/etc/php-fpm.d/plesk-php*-fpm/$domain.conf"
|
||||||
[ -f "$pool_config" ] && echo "$pool_config" && return 0
|
[ -f "$pool_config" ] && echo "$pool_config" && return 0
|
||||||
|
fi
|
||||||
|
|
||||||
# InterWorx pools
|
# InterWorx pools
|
||||||
|
if [ -n "$domain" ]; then
|
||||||
pool_config="/home/$username/var/$domain/php-fpm.conf"
|
pool_config="/home/$username/var/$domain/php-fpm.conf"
|
||||||
[ -f "$pool_config" ] && echo "$pool_config" && return 0
|
[ -f "$pool_config" ] && echo "$pool_config" && return 0
|
||||||
|
fi
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user