123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- /**
- * run with command
- * php start.php start
- */
- ini_set('display_errors', 'on');
- use Workerman\Worker;
- //重定向目录
- $cur_dir = dirname(__FILE__);
- chdir($cur_dir);
- if(strpos(strtolower(PHP_OS), 'win') === 0)
- {
- exit("start.php not support windows, please use start_for_win.bat\n");
- }
- // 检查扩展
- if(!extension_loaded('pcntl'))
- {
- exit("Please install pcntl extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
- }
- if(!extension_loaded('posix'))
- {
- exit("Please install posix extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
- }
- // 标记是全局启动
- define('GLOBAL_START', 1);
- ini_set('memory_limit', '10000M');
- /*
- 由于TP5自带composer库的加载器.
- 如果直接使用vendor的autoload会导致函数重定义错误
- 所以直接从入口处引入tp文件,即可加载workerman
- */
- define('APP_PATH', __DIR__.'/application/');
- require __DIR__.'/thinkphp/base.php';
- //require_once __DIR__ . '/vendor/autoload.php';
- // 加载所有Applications/*/start.php,以便启动所有服务
- require_once __DIR__.'/application/chat/start_businessworker.php';
- require_once __DIR__.'/application/chat/start_gateway.php';
- require_once __DIR__.'/application/chat/start_register.php';
- // 运行所有服务
- Worker::runAll();
|