Add error handling for missing vendor to prevent 500 Empty Body errors
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
<?php
|
||||
// Load environment variables from .env file
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
$autoloadPath = realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
if ($autoloadPath) {
|
||||
require_once $autoloadPath;
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo json_encode(['status' => 'failure', 'message' => 'Vendor autoload missing in location server. Please run composer install.']);
|
||||
exit;
|
||||
}
|
||||
require_once __DIR__ . '/load_env.php';
|
||||
|
||||
$env_file = file_exists(__DIR__ . '/../loction-keys/.env')
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
$autoload = __DIR__ . '/../vendor/autoload.php';
|
||||
if (file_exists($autoload)) {
|
||||
require_once $autoload;
|
||||
} else {
|
||||
http_response_code(500);
|
||||
echo json_encode(['status' => 'failure', 'message' => 'Vendor autoload missing. Please run composer install.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// 2. لا حاجة لتحميل .env يدوياً: Docker يحقن المتغيّرات عبر env_file
|
||||
|
||||
Reference in New Issue
Block a user