start.php 900 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. exit("Please install posix extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
  19. }
  20. // 标记是全局启动
  21. define('GLOBAL_START', 1);
  22. require_once __DIR__ . '/vendor/autoload.php';
  23. require_once __DIR__ . '/config.php';
  24. // 加载所有Applications/*/start.php,以便启动所有服务
  25. foreach (glob(__DIR__ . '/Applications/*/start*.php') as $start_file) {
  26. require_once $start_file;
  27. }
  28. // 运行所有服务
  29. Worker::runAll();