From 6ad7aceee1fef8c4ca860902f4d9fe6f1dc3fd7b Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Tue, 23 Jun 2026 17:46:33 +0300 Subject: [PATCH] Update: 2026-06-23 17:46:32 --- backend/core/bootstrap.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/core/bootstrap.php b/backend/core/bootstrap.php index 9a7ee44..fe995b6 100644 --- a/backend/core/bootstrap.php +++ b/backend/core/bootstrap.php @@ -57,11 +57,10 @@ if ($vendorPath) require_once $vendorPath; require_once __DIR__ . '/helpers.php'; // تحديد مسار الـ .env بشكل ديناميكي -$homeDir = realpath(__DIR__ . '/../../../'); -if (!$homeDir || !is_dir($homeDir)) { - // Fallback if realpath fails - $siteUser = get_current_user(); - $homeDir = "/home/$siteUser"; +if (preg_match('#^(/home/[^/]+)#', __DIR__, $matches)) { + $homeDir = $matches[1]; +} else { + $homeDir = dirname($_SERVER['DOCUMENT_ROOT'] ?? __DIR__); } $envFile = getenv('ENV_FILE_PATH') ?: ($homeDir . '/.env');