Service startup and management

Swoft has comprehensive command line tools and corresponding server management commands

Help command

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

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

      --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:
  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 

reload just re-releases the memory, only useful during the development process, do not use it online.

You can rest assured to use restart when updating the code. The underlying swoole optimized without interrupting the request being processed.

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 WebSocket server, optional whether to support both http treatment

 // 启动服务
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

Use 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 your .env has SWOFT_DEBUG=1 turned on, you will see more detailed startup and loading information.

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

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

        return $config;

Restart swowt, you can see that no information is output.