Files
server-manager/public/index.php
2026-06-06 17:58:34 -04:00

35 lines
902 B
PHP
Executable File

<?php
declare(strict_types=1);
if (PHP_VERSION_ID < 80300) {
http_response_code(500);
die('ServerManager requires PHP 8.3 or higher.');
}
if (!file_exists(dirname(__DIR__) . '/vendor/autoload.php')) {
http_response_code(500);
die('Dependencies not installed. Run: composer install');
}
require_once dirname(__DIR__) . '/vendor/autoload.php';
use ServerManager\Core\App;
try {
$app = App::getInstance();
$app->boot(dirname(__DIR__));
$app->run();
} catch (\Throwable $e) {
http_response_code(500);
if (($_ENV['APP_DEBUG'] ?? false) === 'true') {
echo '<h1>Server Error</h1>';
echo '<pre>' . htmlspecialchars($e->getMessage()) . '</pre>';
echo '<pre>' . $e->getTraceAsString() . '</pre>';
} else {
echo '<h1>500 Internal Server Error</h1>';
echo '<p>An unexpected error occurred. Please check the logs.</p>';
}
}