You've already forked Atomcms-edit
44 lines
1.4 KiB
PHP
Executable File
44 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
use Illuminate\Contracts\Http\Kernel;
|
|
use Illuminate\Http\Request;
|
|
|
|
/**
|
|
* Bulletproof Cross-Platform Bootstrap
|
|
* Works on: Linux (Nginx/Apache), Windows (IIS/XAMPP), Docker
|
|
*/
|
|
|
|
// Windows path fix
|
|
if (PHP_OS_FAMILY === 'Windows') {
|
|
$_SERVER['SCRIPT_FILENAME'] = str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME'] ?? '');
|
|
$_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT'] ?? '');
|
|
}
|
|
|
|
// Auto-create storage symlink if missing (crucial for Windows)
|
|
$storageLink = __DIR__ . '/storage';
|
|
$storageTarget = __DIR__ . '/../storage/app/public';
|
|
if (! file_exists($storageLink) && is_dir($storageTarget)) {
|
|
if (PHP_OS_FAMILY === 'Windows') {
|
|
@shell_exec('mklink /J "' . str_replace('/', '\\', $storageLink) . '" "' . str_replace('/', '\\', $storageTarget) . '"');
|
|
} else {
|
|
@symlink($storageTarget, $storageLink);
|
|
}
|
|
}
|
|
|
|
// Ensure storage directories exist with proper permissions
|
|
$storageDirs = [__DIR__ . '/../storage/framework/cache', __DIR__ . '/../storage/framework/sessions', __DIR__ . '/../storage/framework/views', __DIR__ . '/../storage/logs'];
|
|
foreach ($storageDirs as $dir) {
|
|
if (! is_dir($dir)) {
|
|
@mkdir($dir, 0755, true);
|
|
}
|
|
}
|
|
|
|
require __DIR__ . '/../vendor/autoload.php';
|
|
$app = require_once __DIR__ . '/../bootstrap/app.php';
|
|
$kernel = $app->make(Kernel::class);
|
|
$response = $kernel->handle(
|
|
$request = Request::capture(),
|
|
);
|
|
$response->send();
|
|
$kernel->terminate($request, $response);
|