start.php 854 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * run with command
  4. * php start.php start
  5. */
  6. ini_set('display_errors', 'on');
  7. use Workerman\Worker;
  8. if(strpos(strtolower(PHP_OS), 'win') === 0)
  9. {
  10. exit("start.php not support windows, please use start_for_win.bat\n");
  11. }
  12. // 检查扩展
  13. if(!extension_loaded('pcntl'))
  14. {
  15. exit("Please install pcntl extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
  16. }
  17. if(!extension_loaded('posix'))
  18. {
  19. exit("Please install posix extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
  20. }
  21. // 标记是全局启动
  22. define('GLOBAL_START', 1);
  23. require_once __DIR__ . '/vendor/autoload.php';
  24. // 加载所有Applications/*/start.php,以便启动所有服务
  25. foreach(glob(__DIR__.'/app/worker/start*.php') as $start_file)
  26. {
  27. require_once $start_file;
  28. }
  29. // 运行所有服务
  30. Worker::runAll();