Fix critical bugs and add domain-by-domain batch analyzer

- Fix line 63 in php-analyzer.sh: Add default value for count variable (integer comparison error)
- Fix line 655 in php-analyzer.sh: Add default value for memory_error_count (integer comparison error)
- Fix line 396 in php-scanner.sh: Replace unsafe eval with safe getent passwd lookup
- Add php-ui.sh: User interface and menu system (18KB, 25+ functions)
- Add php-scanner.sh: Server enumeration system (17KB, 18 functions)
- Add php-action-executor.sh: Optimization execution system (17KB, 20 functions)
- Add php-server-manager.sh: Orchestration framework (21KB, 7 functions)
- Add php-fpm-batch-analyzer.sh: One-shot diagnostic script showing current vs recommended max_children, memory impact, and optimization potential
- Add comprehensive test suite (24 tests)

These fixes resolve "integer expression expected" errors during domain analysis.
Batch analyzer enables users to see domain-by-domain optimization opportunities before applying changes.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
cschantz
2026-02-17 22:43:49 -05:00
parent 2d92183c6f
commit 13d7054aa1
8 changed files with 3039 additions and 0 deletions
+2
View File
@@ -59,6 +59,7 @@ analyze_memory_exhausted_errors() {
# Find errors in last N days
local count
count=$(find "$log_file" -mtime -"$days" -exec grep -c "Allowed memory size.*exhausted" {} \; 2>/dev/null || echo "0")
count="${count:-0}"
if [ "$count" -gt 0 ]; then
total_count=$((total_count + count))
@@ -651,6 +652,7 @@ detect_php_config_issues() {
memory_errors=$(analyze_memory_exhausted_errors "$username" 7)
local memory_error_count
memory_error_count=$(get_field "$(echo "$memory_errors" | grep "TOTAL")" 1)
memory_error_count="${memory_error_count:-0}"
if [ "$memory_error_count" -gt 0 ]; then
issues+="MEMORY|HIGH|Memory exhausted errors occurred $memory_error_count times in last 7 days|Increase memory_limit or optimize code"$'\n'