-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathrun.php
More file actions
executable file
·36 lines (29 loc) · 837 Bytes
/
run.php
File metadata and controls
executable file
·36 lines (29 loc) · 837 Bytes
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
<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
ini_set('memory_limit','1024M');
include __dir__.'/Core/autoload.php';
class App{
protected $controller = null;
public function start($host, $port){
$controller = $this->controller;
$http = new \swoole_http_server($host, $port, SWOOLE_BASE);
$http->on('request', array($this, 'onRequest'));
$http->set([
'worker_num' => 2,
]);
$this->controller = new MyController();
$http->start();
}
public function onRequest($request, $response){
//echo "worker onRequest\n";
$this->controller->run($request, $response);
static $i=0;
if($i++ >= 1000){
echo "----->Mem: ", memory_get_usage(), "b\n";
$i = 0;
}
}
}
$app = new App();
$app->start('', 9502);