From 91d0e625c47418df29e0e999c5aa6378feca69f6 Mon Sep 17 00:00:00 2001 From: Myron Blair Date: Sat, 20 Jun 2026 17:06:51 +0000 Subject: [PATCH] fix: decouple php-fpm reload from HTTP request using flag file + cron Reload during account creation was causing 502 by killing the fpm worker before nginx finished reading the response. Flag file picked up by cron within 60s instead. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01LP9Q4kfCAYAjJnsbHBrViZ --- panel/lib/PHPManager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/panel/lib/PHPManager.php b/panel/lib/PHPManager.php index c2719f9..8dea225 100644 --- a/panel/lib/PHPManager.php +++ b/panel/lib/PHPManager.php @@ -118,8 +118,8 @@ php_value[max_execution_time] = 30 } private static function reloadFPM(string $ver): void { - // Run reload in background so it doesn't block/kill the current PHP-FPM worker. - // The short sleep ensures the pool config is fully written before reload picks it up. - exec("(sleep 1 && sudo systemctl reload php{$ver}-fpm) /dev/null 2>&1 &"); + // Write a flag file instead of reloading inline — the cron runner picks this up + // within 60s and reloads fpm outside of any HTTP request, avoiding 502s. + @file_put_contents('/tmp/novacpx-fpm-reload-' . $ver, '1'); } }