-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.php
More file actions
34 lines (26 loc) · 778 Bytes
/
start.php
File metadata and controls
34 lines (26 loc) · 778 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
<?php
/**
* run with command
* php start.php start
*/
require_once __DIR__ . '/vendor/autoload.php';
use App\Worker;
use App\Thrift\ThriftWorker;
use App\Resque\ResqueWorker;
// 检查扩展
if (!extension_loaded('pcntl')) {
exit("Please install pcntl extension. See http://doc3.workerman.net/install/install.html\n");
}
if (!extension_loaded('posix')) {
exit("Please install posix extension. See http://doc3.workerman.net/install/install.html\n");
}
Worker::$logFile = __DIR__ . '/workerman.log';
Worker::$pidFile = __DIR__ . '/workerman.pid';
// 初始化所有服务
$worker = new ThriftWorker('tcp://0.0.0.0:9090');
$worker->count = 16;
$worker->class = 'Resque';
$worker = new ResqueWorker();
$worker->count = 16;
// 运行所有服务
Worker::runAll();