php easyswoole start 报错

今天启动 easyswoole 的时候报错:

[2019-08-07 16:12:38][DEBUG][ERROR] : [Uncaught Swoole\Exception: failed to listen server port[0.0.0.0:9501], Error: Address already in use[98] in /www/wwwroot/swoole.blt.com/vendor/easyswoole/easyswoole/src/ServerManager.php:57
 Stack trace:
 0 /www/wwwroot/swoole.blt.com/vendor/easyswoole/easyswoole/src/ServerManager.php(57): Swoole\Server->__construct('0.0.0.0', 9501, 2, 1)
 1 /www/wwwroot/swoole.blt.com/vendor/easyswoole/easyswoole/src/Core.php(115): EasySwoole\EasySwoole\ServerManager->createSwooleServer(9501, 2, '0.0.0.0', Array, 2, 1)
 2 /www/wwwroot/swoole.blt.com/vendor/easyswoole/easyswoole/src/Command/DefaultCommand/Start.php(42): EasySwoole\EasySwoole\Core->createServer()
 3 /www/wwwroot/swoole.blt.com/vendor/easyswoole/easyswoole/src/Command/CommandContainer.php(46): EasySwoole\EasySwoole\Command\DefaultCommand\Start->exec(Array)
 4 /www/wwwroot/swoole.blt.com/vendor/easyswoole/easyswoole/src/Command/CommandRunner.php(50): EasySwoole\EasySwoole\Command\CommandContainer->hook('start', Array)
 5 /www/wwwroot/swoole.blt.com/easyswoole(24) at file:/www/wwwroot/swoole.blt.com/vendor/easyswoole/easyswoole/src/ServerManager.php line:57]

 ————————————–

解决方案

查找这个端口号的pid(我的代码监听的端口是9501),得到PID

输入:netstat -apn | grep 9501

查看进程 发现是 8831 占用了。

输入:kill -9 8831

kill 8831  即可

重启启动成功!OJBK!

发表回复