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 }