newone.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * run with command
  4. * php start.php start
  5. */
  6. ini_set('display_errors', 'on');
  7. use Workerman\Worker;
  8. //重定向目录
  9. $cur_dir = dirname(__FILE__);
  10. chdir($cur_dir);
  11. if(strpos(strtolower(PHP_OS), 'win') === 0)
  12. {
  13. exit("start.php not support windows, please use start_for_win.bat\n");
  14. }
  15. // 检查扩展
  16. if(!extension_loaded('pcntl'))
  17. {
  18. exit("Please install pcntl extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
  19. }
  20. if(!extension_loaded('posix'))
  21. {
  22. exit("Please install posix extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
  23. }
  24. // 标记是全局启动
  25. define('GLOBAL_START', 1);
  26. ini_set('memory_limit', '10000M');
  27. /*
  28. 由于TP5自带composer库的加载器.
  29. 如果直接使用vendor的autoload会导致函数重定义错误
  30. 所以直接从入口处引入tp文件,即可加载workerman
  31. */
  32. define('APP_PATH', __DIR__.'/application/');
  33. require __DIR__.'/thinkphp/base.php';
  34. //require_once __DIR__ . '/vendor/autoload.php';
  35. // 加载所有Applications/*/start.php,以便启动所有服务
  36. require_once __DIR__.'/application/chat/start_businessworker.php';
  37. require_once __DIR__.'/application/chat/start_gateway.php';
  38. require_once __DIR__.'/application/chat/start_register.php';
  39. // 运行所有服务
  40. Worker::runAll();