From 17fa38f349f8f802855f82245349410807597bff Mon Sep 17 00:00:00 2001 From: cschantz Date: Wed, 18 Feb 2026 17:30:32 -0500 Subject: [PATCH] Fix find_fpm_pool_config to work properly on cPanel - Update find_fpm_pool_config in php-action-executor.sh - Add proper domain matching for cPool configs - cPanel names pool configs after the domain, not the username - Add wildcard matching as fallback - Function now successfully locates pool config files - Critical fix for single-domain optimization in Option 4 Co-Authored-By: Claude Haiku 4.5 --- lib/php-action-executor.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/php-action-executor.sh b/lib/php-action-executor.sh index 76e007b..3f1d8fd 100755 --- a/lib/php-action-executor.sh +++ b/lib/php-action-executor.sh @@ -514,13 +514,26 @@ find_fpm_pool_config() { local username="$1" local domain="$2" - # Try using existing function if available - if type find_fpm_pool_config_internal >/dev/null 2>&1; then - find_fpm_pool_config_internal "$username" "$domain" - return $? + local pool_config="" + + # Try cPanel paths first (most common) + # cPanel typically names pools after the domain + 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 - # Fallback: search common locations + # Try username + 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; } + + # Try matching any domain under this user + if [ -n "$domain" ]; then + pool_config=$(find /opt/cpanel/ea-php*/root/etc/php-fpm.d/ -name "*$domain*" 2>/dev/null | head -1) + [ -n "$pool_config" ] && { echo "$pool_config"; return 0; } + fi + + # Try Debian/Ubuntu paths local common_paths=( "/etc/php-fpm.d/${username}.conf" "/etc/php/7.4/fpm/pool.d/${username}.conf"