-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathindex.php
More file actions
62 lines (54 loc) · 2.01 KB
/
Copy pathindex.php
File metadata and controls
62 lines (54 loc) · 2.01 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
// --------------------------------------------------------------
// Activate output buffering
// --------------------------------------------------------------
ob_start();
// --------------------------------------------------------------
// Record the start timer (for benchmark)
// --------------------------------------------------------------
define('RAKIT_START', microtime(true));
// --------------------------------------------------------------
// Define some useful constants
// --------------------------------------------------------------
define('DS', DIRECTORY_SEPARATOR);
define('CRLF', "\r\n");
define('TAB', "\t");
define('CR', "\r");
define('LF', "\n");
// --------------------------------------------------------------
// Include the framework's path definitions
// --------------------------------------------------------------
require __DIR__ . DS . 'paths.php';
// --------------------------------------------------------------
// Detect Worker Mode (FrankenPHP / RoadRunner / Swoole)
// --------------------------------------------------------------
$worker = null;
if (function_exists('frankenphp_handle_request')) {
define('RAKIT_WORKER_MODE', 'frankenphp');
$worker = 'frankenphp';
} elseif (
function_exists('getenv')
&& getenv('RR_MODE') !== false
) {
define('RAKIT_WORKER_MODE', 'roadrunner');
$worker = 'roadrunner';
} elseif (
extension_loaded('swoole')
&& isset($_SERVER['SERVER_SOFTWARE'])
&& strpos($_SERVER['SERVER_SOFTWARE'], 'swoole') !== false
) {
define('RAKIT_WORKER_MODE', 'swoole');
$worker = 'swoole';
}
// --------------------------------------------------------------
// Run the framework
// --------------------------------------------------------------
require path('system') . 'boot.php';
// --------------------------------------------------------------
// Worker Loop
// --------------------------------------------------------------
if ($worker !== null) {
$runner = \System\Bridges\Worker::create($worker);
unset($worker);
$runner->run();
}