<?php //加载配置文件 include "config.mvc.php"; $command = isset($argv[1]) ? $argv[1] : ''; $daemonize = isset($argv[2]) ? false : true; switch ($command) { case 'start': __start($daemonize); break; case 'stop': __stop(); break; case 'status': __status(); break; case 'reload': __reload(); break; default: echo "usage: php -q server.php [start|stop|reload|status]\n"; exit(1); } exit(0); function __start($daemonize = true) { if ($pid = __getpid()) { echo sprintf("other swoole httpserver run at pid %d\n", $pid); exit(1); } echo "swoole httpserver start\n";
<?php define('SITE_MODE', true); require __DIR__ . '/boot.php'; $command = isset($argv[1]) ? $argv[1] : ''; switch ($command) { case 'start': __start(); break; case 'stop': __stop(); break; case 'status': __status(); break; case 'reload': __reload(); break; default: echo "usage: php -q server.php [start|stop|reload|status]\n"; exit(1); } exit(0); //////////////////////////////////////////////////////////////////////////////// function __start() { if ($pid = __getpid()) { echo sprintf("other server run at pid %d\n", $pid); exit(1); } echo "server start\n";