think-swoole icon indicating copy to clipboard operation
think-swoole copied to clipboard

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

Open seebyyu opened this issue 6 months ago • 0 comments

场景

同一套代码,可以跑不同的配置 理想情况是 修改 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

seebyyu avatar Aug 23 '24 02:08 seebyyu