61 lines
1.5 KiB
PHP
Executable File
61 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
use CodeIgniter\Boot;
|
|
use Config\Paths;
|
|
|
|
/**
|
|
* CodeIgniter 4 Front Controller
|
|
*/
|
|
|
|
// Check PHP version.
|
|
$minPhpVersion = '8.1';
|
|
if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
|
|
$message = sprintf(
|
|
'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
|
|
$minPhpVersion,
|
|
PHP_VERSION
|
|
);
|
|
|
|
header('HTTP/1.1 503 Service Unavailable.', true, 503);
|
|
echo $message;
|
|
|
|
exit(1);
|
|
}
|
|
|
|
/*
|
|
*---------------------------------------------------------------
|
|
* SET THE CURRENT DIRECTORY
|
|
*---------------------------------------------------------------
|
|
*/
|
|
// Path to the front controller (this file)
|
|
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
|
|
|
|
// Ensure the current directory is pointing to the front controller's directory
|
|
if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) {
|
|
chdir(FCPATH);
|
|
}
|
|
|
|
/*
|
|
*---------------------------------------------------------------
|
|
* BOOTSTRAP THE APPLICATION
|
|
*---------------------------------------------------------------
|
|
*/
|
|
|
|
// LOAD COMPOSER AUTOLOADER
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
// LOAD ENVIRONMENT VARIABLES
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/..');
|
|
$dotenv->load();
|
|
$dotenv->required(['DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASS', 'ENVIRONMENT']);
|
|
|
|
// LOAD OUR PATHS CONFIG FILE
|
|
require FCPATH . '../app/Config/Paths.php';
|
|
|
|
$paths = new Paths();
|
|
|
|
// LOAD THE FRAMEWORK BOOTSTRAP FILE
|
|
require $paths->systemDirectory . '/Boot.php';
|
|
|
|
exit(Boot::bootWeb($paths));
|