From 729583581cbfcad11c8e2c7e1691ecd47938d170 Mon Sep 17 00:00:00 2001 From: Developer Date: Mon, 20 Apr 2026 21:32:47 -0400 Subject: [PATCH] FIX: Correct undefined TOTAL_RAM_MB variable in optimize_level_5_everything In the optimize_level_5_everything() function, two instances of $TOTAL_RAM_MB (uppercase, undefined) were being passed to functions instead of $total_ram_mb (lowercase, locally defined from server capacity). This would cause the functions to receive empty values, leading to calculation failures or hangs. Fixed: - Line 2675: calculate_server_capacity call - Line 2756: calculate_optimal_php_settings_intelligent call The variable $total_ram_mb is correctly defined on line 2650 and should be used throughout the function. --- modules/performance/php-optimizer.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/performance/php-optimizer.sh b/modules/performance/php-optimizer.sh index b53f581..97df25e 100755 --- a/modules/performance/php-optimizer.sh +++ b/modules/performance/php-optimizer.sh @@ -2672,7 +2672,7 @@ optimize_level_5_everything() { # Calculate server capacity for fair share allocation local server_capacity_result - server_capacity_result=$(calculate_server_capacity "$TOTAL_RAM_MB") + server_capacity_result=$(calculate_server_capacity "$total_ram_mb") local server_capacity server_capacity=$(echo "$server_capacity_result" | cut -d'|' -f1) local server_memory_per_process @@ -2753,7 +2753,7 @@ optimize_level_5_everything() { # Call intelligent three-constraint function local intel_result - intel_result=$(calculate_optimal_php_settings_intelligent "$username" "$TOTAL_RAM_MB" "$server_capacity" "$traffic_pct" 2>/dev/null || echo "20|dynamic|1|5|ERROR|Failed") + intel_result=$(calculate_optimal_php_settings_intelligent "$username" "$total_ram_mb" "$server_capacity" "$traffic_pct" 2>/dev/null || echo "20|dynamic|1|5|ERROR|Failed") recommended_max=$(echo "$intel_result" | cut -d'|' -f1) recommended_memory=$(calculate_optimal_memory_limit "$username" "$domain" "$recommended_max" 2>/dev/null || echo "128M")