-
-
Notifications
You must be signed in to change notification settings - Fork 133
/
Copy pathindex.php
40 lines (33 loc) · 915 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
use Yiisoft\Yii\Runner\Http\HttpApplicationRunner;
if (getenv('YII_C3')) {
$c3 = dirname(__DIR__) . '/c3.php';
if (file_exists($c3)) {
require_once $c3;
}
}
/**
* @psalm-var string $_SERVER['REQUEST_URI']
*/
// PHP built-in server routing.
if (PHP_SAPI === 'cli-server') {
// Serve static files as is.
/** @psalm-suppress MixedArgument */
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (is_file(__DIR__ . $path)) {
return false;
}
// Explicitly set for URLs with dot.
$_SERVER['SCRIPT_NAME'] = '/index.php';
}
chdir(dirname(__DIR__));
require_once dirname(__DIR__) . '/autoload.php';
// Run HTTP application runner
$runner = new HttpApplicationRunner(
rootPath: dirname(__DIR__),
debug: $_ENV['YII_DEBUG'],
checkEvents: $_ENV['YII_DEBUG'],
environment: $_ENV['YII_ENV']
);
$runner->run();