easyswoole启动端口被占用

Swoole / 1490人浏览 / 0人评论

EasySwoole 是一款基于 Swoole Server 开发的常驻内存型的分布式 PHP 框架,专为 API 而生,摆脱传统 PHP 运行模式在进程唤起和文件加载上带来的性能损失。 EasySwoole 高度封装了 Swoole Server 而依旧维持 Swoole Server 原有特性,支持同时混合监听 HTTP、自定义 TCP、UDP 协议,让开发者以最低的学习成本和精力编写出多进程、可异步、高可用的应用服务。

EasySwoole 是一款基于 Swoole Server 开发的常驻内存型的分布式 PHP 框架,专为 API 而生,摆脱传统 PHP 运行模式在进程唤起和文件加载上带来的性能损失。 EasySwoole 高度封装了 Swoole Server 而依旧维持 Swoole Server 原有特性,支持同时混合监听 HTTP、自定义 TCP、UDP 协议,让开发者以最低的学习成本和精力编写出多进程、可异步、高可用的应用服务。

EasySwoole启动端口被占用。

PHP Fatal error:  Uncaught Swoole\Exception: failed to listen server port[0.0.0.0:9501], Error: Address already in use[98]
PHP Fatal error:  Uncaught Swoole\Exception: failed to listen server port[0.0.0.0:9501], Error: Address already in use[98] in /vendor/easyswoole/easyswoole/src/ServerManager.php:58
Stack trace:
#0 /vendor/easyswoole/easyswoole/src/ServerManager.php(58): Swoole\Server->__construct()
#1 /vendor/easyswoole/easyswoole/src/Core.php(104): EasySwoole\EasySwoole\ServerManager->createSwooleServer()
#2 /vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Server.php(112): EasySwoole\EasySwoole\Core->createServer()
#3 /vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Server.php(52): EasySwoole\EasySwoole\Command\DefaultCommand\Server->start()
#4 /vendor/easyswoole/command/src/CommandManager.php(101): EasySwoole\EasySwoole\Command\DefaultCommand\Server->exec()
#5 /vendor/easyswoole/easyswoole/src/Command/CommandRunner.php( in /vendor/easyswoole/easyswoole/src/ServerManager.php on line 58
Fatal error: Uncaught Swoole\Exception: failed to listen server port[0.0.0.0:9501], Error: Address already in use[98] in /vendor/easyswoole/easyswoole/src/ServerManager.php:58
Stack trace:
#0 /vendor/easyswoole/easyswoole/src/ServerManager.php(58): Swoole\Server->__construct()
#1 /vendor/easyswoole/easyswoole/src/Core.php(104): EasySwoole\EasySwoole\ServerManager->createSwooleServer()
#2 /vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Server.php(112): EasySwoole\EasySwoole\Core->createServer()
#3 /vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Server.php(52): EasySwoole\EasySwoole\Command\DefaultCommand\Server->start()
#4 /vendor/easyswoole/command/src/CommandManager.php(101): EasySwoole\EasySwoole\Command\DefaultCommand\Server->exec()
#5 /vendor/easyswoole/easyswoole/src/Command/CommandRunner.php( in /vendor/easyswoole/easyswoole/src/ServerManager.php on line 58
[2021-12-14 23:06:09][trigger][error]:[Uncaught Swoole\Exception: failed to listen server port[0.0.0.0:9501], Error: Address already in use[98] in /vendor/easyswoole/easyswoole/src/ServerManager.php:58
Stack trace:
#0 /vendor/easyswoole/easyswoole/src/ServerManager.php(58): Swoole\Server->__construct()
#1 /vendor/easyswoole/easyswoole/src/Core.php(104): EasySwoole\EasySwoole\ServerManager->createSwooleServer()
#2 /vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Server.php(112): EasySwoole\EasySwoole\Core->createServer()
#3 /vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Server.php(52): EasySwoole\EasySwoole\Command\DefaultCommand\Server->start()
#4 /vendor/easyswoole/command/src/CommandManager.php(101): EasySwoole\EasySwoole\Command\DefaultCommand\Server->exec()
#5 /vendor/easyswoole/easyswoole/src/Command/CommandRunner.php( at file:/vendor/easyswoole/easyswoole/src/ServerManager.php line:58]

EasySwoole默认监听端口号9501

查看端口命令

netstat -anp  | grep  port

操作案例

netstat -anp  | grep  9501

[root xxxxxx xxxxxx]# netstat -anp | grep 9501
tcp 1 0 0.0.0.0:9501 0.0.0.0:* LISTEN 22860/EasySwoole

tcp 336 0 127.0.0.1:9501 127.0.0.1:49362 CLOSE_WAIT -

22860为进程ID

把进程kill掉重新启动即可

kill进程命令

kill -9 pid

kill -9 22860

重新启动

php easyswoole server start
#!/usr/bin/env php
  ______                          _____                              _
 |  ____|                        / ____|                            | |
 | |__      __ _   ___   _   _  | (___   __      __   ___     ___   | |   ___
 |  __|    / _` | / __| | | | |  \___ \  \ \ /\ / /  / _ \   / _ \  | |  / _ \
 | |____  | (_| | \__ \ | |_| |  ____) |  \ V  V /  | (_) | | (_) | | | |  __/
 |______|  \__,_| |___/  \__, | |_____/    \_/\_/    \___/   \___/  |_|  \___|
                          __/ |
                         |___/

main server                   SWOOLE_WEB
listen address                0.0.0.0
listen port                   9501
worker_num                    8
reload_async                  true
max_wait_time                 3
pid_file                      /Temp/pid.pid
log_file                      /Log/swoole.log
user                          root
swoole version                4.7.1
php version                   7.4.24
easyswoole version            3.4.6
run mode                      dev
temp dir                      /Temp
log dir                       /Log

转载注明:

0 条评论

还没有人发表评论

发表评论 取消回复

记住我的信息,方便下次评论
有人回复时邮件通知我