getMessage() . ' @ ' . $e->getFile() . ':' . $e->getLine()); if (!headers_sent()) { http_response_code(500); header('Content-Type: application/json'); } echo json_encode(['error' => 'internal server error', 'code' => 'internal']); }); $configPath = __DIR__ . '/../config.php'; if (!is_file($configPath)) { http_response_code(500); header('Content-Type: application/json'); echo json_encode(['error' => 'server not configured: missing config.php', 'code' => 'no_config']); exit; } Config::load(require $configPath);