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');