Skip to content

php think swoole 无法动态指定端口号 #373

@seebyyu

Description

@seebyyu

场景

同一套代码,可以跑不同的配置
理想情况是 修改 config/swoole.php 的 http.port 写到 env 里面

'http'       => [
    'enable'     => true,
    'host'       => '0.0.0.0',
    'port'       => env('SWOOLE_PORT', 8080),
    'worker_num' => swoole_cpu_num(),
    'options'    => [],
],

然后使用命令,可以加载不同配置

php think swoole --env

实际效果是端口依旧使用的是 默认 .env 指定的端口 而且 php think swoole 的入参也不支持自定义端口号。
类似这样

php think swoole --env dev --port 8081

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions