start.php 712 B

1234567891011121314151617181920212223242526272829303132
  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. if(!extension_loaded('pcntl'))
  10. {
  11. exit("Please install pcntl extension. See http://doc3.workerman.net/install/install.html\n");
  12. }
  13. if(!extension_loaded('posix'))
  14. {
  15. exit("Please install posix extension. See http://doc3.workerman.net/install/install.html\n");
  16. }
  17. // 标记是全局启动
  18. define('GLOBAL_START', 1);
  19. require_once __DIR__ . '/Workerman/Autoloader.php';
  20. // 加载所有Applications/*/start.php,以便启动所有服务
  21. foreach(glob(__DIR__.'/Applications/*/start*.php') as $start_file)
  22. {
  23. require_once $start_file;
  24. }
  25. // 运行所有服务
  26. Worker::runAll();