start.php 925 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. exit("start.php not support windows, please use start_for_win.bat\n");
  10. }
  11. // 检查扩展
  12. if (!extension_loaded('pcntl')) {
  13. exit("Please install pcntl extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
  14. }
  15. if (!extension_loaded('posix')) {
  16. exit("Please install posix extension. See http://doc3.workerman.net/appendices/install-extension.html\n");
  17. }
  18. // 标记是全局启动
  19. define('GLOBAL_START', 1);
  20. // 加载配置文件
  21. require_once __DIR__ . '/config.php';
  22. require_once __DIR__ . '/vendor/autoload.php';
  23. // 加载所有Applications/*/start.php,以便启动所有服务
  24. foreach (glob(__DIR__ . '/Applications/*/start*.php') as $start_file) {
  25. require_once $start_file;
  26. }
  27. // 运行所有服务
  28. Worker::runAll();