Service startup and Management

Swoft has a comprehensive command-line tool, and the corresponding server management commands

Help commands

[root@swoft]# php bin/swoft -h
Console application description (Version: 2.0.0)

Usage:
  bin/swoft COMMAND [arg0 arg1 arg2 ...] [--opt -v -h ...]

Options:
      --debug      Setting the application runtime debug level(0 - 4)
      --no-color   Disable color/ANSI for message output
  -h, --help       Display this help message
  -V, --version    Show application version information
      --expand     Expand sub-commands for all command groups

Available Commands:
  docs     Class DocsCommand
  http     Provide some commands to manage the swoft HTTP Server(alias: httpserver,httpServer,http-server)
  rpc      Class ServiceServerCommand
  test     Class TestCommand
  ws       Provide some commands to operate swoft WebSocket Server(alias: ws-server,wsserver,websocket)

More command information, please use: bin/swoft COMMAND -h

HTTP Server

// 启动服务
php bin/swoft http:start

// 守护进程启动
php bin/swoft http:start -d

// 重启
php bin/swoft http:restart

// 重新加载
php bin/swoft http:reload

// 关闭服务
php bin/swoft http:stop

WebSocket Server

Start the WebSocket server to choose whether to support HTTP processing at the same time

// 启动服务
php bin/swoft ws:start

// 守护进程启动
php bin/swoft ws:start -d

// 重启
php bin/swoft ws:restart

// 重新加载
php bin/swoft ws:reload

// 关闭服务
php bin/swoft ws:stop

RPC Server

Using a standalone RPC server

// 启动服务
php bin/swoft rpc:start

// 守护进程启动
php bin/swoft rpc:start -d

// 重启
php bin/swoft rpc:restart

// 重新加载
php bin/swoft rpc:reload

// 关闭服务
php bin/swoft rpc:stop

Startup information

By default, some startup information is printed to the console at startup.

If you .env turn it on, you SWOFT_DEBUG=1 will see more detailed startup and load information.

If you want to turn off this information, you can app/Application add:


    public function getCLoggerConfig(): array
    {
        $config = parent::getCLoggerConfig();
        // disable print console start log
        $config['enable'] = false;

        return $config;
    }

Restart Swoft and you can see that there won't be any information output.

/docs/2.x/en/quick-start/start-swoft.html
progress-bar