ServerManager project files
This commit is contained in:
34
public/index.php
Executable file
34
public/index.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?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>';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user