内部调用shell_exec('/usr/local/nginx/sbin/nginx');导致无法关闭

601430051

在linux系统中
在onMessage函数中执行
shell_exec('/usr/local/nginx/sbin/nginx');

第一次执行onMessage消息以后,可以正常把nginx服务起来。
但是我用 Ctrl-C 把服务停了以后。

重新执行

# php service.php start
Workerman start in DEBUG mode
PHP Warning:  stream_socket_server(): unable to connect to tcp://0.0.0.0:2345 (Address already in use) in /home/workerman/Worker.php on line 1443

Warning: stream_socket_server(): unable to connect to tcp://0.0.0.0:2345 (Address already in use) in /home/workerman/Worker.php on line 1443
PHP Fatal error:  Uncaught exception 'Exception' with message 'Address already in use' in /home/workerman/Worker.php:1445
Stack trace:
#0 /home/workerman/Worker.php(536): Workerman\Worker->listen()
#1 /home/workerman/Worker.php(431): Workerman\Worker::initWorkers()
#2 /home/workerman/service.php(39): Workerman\Worker::runAll()
#3 {main}
  thrown in /home/workerman/Worker.php on line 1445

Fatal error: Uncaught exception 'Exception' with message 'Address already in use' in /home/workerman/Worker.php:1445
Stack trace:
#0 /home/workerman/Worker.php(536): Workerman\Worker->listen()
#1 /home/workerman/Worker.php(431): Workerman\Worker::initWorkers()
#2 /home/workerman/service.php(39): Workerman\Worker::runAll()
#3 {main}
  thrown in /home/workerman/Worker.php on line 1445

报这个错误。

一定要把nginx进程杀死才可以重新启动service.php程序

3918 2 0
2个回答

walkor 打赏

这个应该和shell_exec的实现有关系,产生的新进程继承了workerman的监听。
这个不是workerman的问题,不过暂时不知道怎么解决。

  • 暂无评论
601430051

谢谢

  • 暂无评论
年代过于久远,无法发表回答
×
🔝