What to do if workerman connection error occurs
现象1:
启动后报错类似如下:
php start.php start PHP Warning: stream_socket_server(): unable to connect to tcp://xx.xx.xx.xx:xxxx (Address already in use) in /home/workerman-chat/Workerman/Worker.php on line xxxx
关键字: Address already in use
失败原因:
端口被占用,无法启动。
解决办法:
可以通过命令netstat -anp | grep 端口号来找出哪个程序占用了端口。
然后停止对应的程序释放端口解决。
如果不能停止对应端口的程序,可以通过更换workerman的端口解决。
如果是Workerman占用的端口,又无法通过stop命令停止(一般是丢失pid文件或者主进程被开发者kill了导致),可以通过运行以下两个命令杀死Workerman进程。
killall php ps aux|grep WorkerMan|awk '{print $2}'|xargs kill -9
现象2:
启动后报错类似如下:
PHP Warning: stream_socket_server(): unable to connect to tcp://xx.xx.xx.xx:xxx (Cannot assign requested address) in /home/GatewayWorker/Workerman/Worker.php on line xxxx
关键字:Cannot assign requested address
失败原因:
启动脚本ip参数写错,不是本机ip。
解决办法:
请填写本机ip机或者填写 0.0.0.0(表示监听本机所有ip)即可解决。
提示:Linux系统可以通过命令 ifconfig查看本机所有网卡ip。
如果您是腾讯云用户,注意您的公网ip实际是代理服务器ip,公网ip并不属于你的服务器,所以无法通过公网ip绑定,但是可以通过0.0.0.0来绑定。
现象3:
Waring stream_socket_server has been disabled for security reasons in ...
失败原因:
stream_socket_server 函数被php.ini禁用
解决方法:
1、运行php --ini 找到php.ini文件
2、打开php.ini找到disable_functions一项,将stream_socket_server禁用项删掉
现象4:
PHP Warning: stream_socket_server(): unable to connect to tcp://0.0.0.0:xxx (Permission denied)
失败原因:
linux下监听端口如果小于1024,需要root权限。
解决办法:
使用大于1024的端口或者使用root用户启动服务。
PHP中文网,有大量免费的workerman入门教程,欢迎大家学习!
The above is the detailed content of What to do if workerman connection error occurs. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

After updating to the latest win11 system, many users are not sure how to connect the controller to play games. For this reason, we have brought you a detailed tutorial on connecting the win11 controller today. If you haven't completed the connection yet, let's take a look at how to operate it. . How to connect the controller in win11: 1. Click Start below and then enter Windows Settings to open the "Control Panel". 2. After entering, you can find "View devices and printers" to enter. 3. At this point you can see the information about the controller device and just make the connection. 4. After the connection is successful, a √ appears, and the connection is completed.

How to connect the keep body fat scale? Keep has a specially designed body fat scale, but most users do not know how to connect the keep body fat scale. Next is the graphic tutorial on the connection method of the keep body fat scale that the editor brings to users. , interested users come and take a look! How to connect the keep body fat scale 1. First open the keep software, go to the main page, click [My] in the lower right corner, and select [Smart Hardware]; 2. Then on the My Smart Devices page, click the [Add Device] button in the middle; 3 , then select the device you want to add interface, select [Smart Body Fat/Weight Scale]; 4. Then on the device model selection page, click the [keep body fat scale] option; 5. Finally, in the interface shown below, finally [Add Now] at the bottom

Brief introduction to the reason for the http request error: 504GatewayTimeout: During network communication, the client interacts with the server by sending HTTP requests. However, sometimes we may encounter some error messages during the process of sending the request. One of them is the 504GatewayTimeout error. This article will explore the causes and solutions to this error. What is the 504GatewayTimeout error? GatewayTimeo

http request error: Solution to SocketError When making network requests, we often encounter various errors. One of the common problems is SocketError. This error is thrown when our application cannot establish a connection with the server. In this article, we will discuss some common causes and solutions of SocketError. First, we need to understand what Socket is. Socket is a communication protocol that allows applications to

What does 0x0000011b mean when connecting to a printer? Users often encounter various error codes when using computers, laptops or other devices. Among them, 0x0000011b is a common printer connection error code. So, what does connecting printer 0x0000011b mean? First, we need to understand the basic principles of printer connection. When we need to print files from the computer, we usually need to connect the printer to the computer for data transfer between the two. This connection can be made via

Solutions to Restricted Network Connections in Win10 With the rapid development of technology, the Internet has become an indispensable part of people's lives. However, sometimes we may encounter some problems when connecting to the Internet on computers using the Windows 10 operating system, one of which is restricted connections. In this case, we cannot access web pages, download files, or use network functions normally. So, is there any way to solve this problem? This article will introduce you to several common solutions. 1. Check the network connection settings. First, I

With the development of the digital era, shared printers have become an indispensable part of the modern office environment. However, sometimes we may encounter the problem that the shared printer cannot be connected to the printer, which will not only affect work efficiency, but also cause a series of troubles. This article aims to explore the reasons and solutions for why a shared printer cannot connect to the printer. There are many reasons why a shared printer cannot connect to the printer, the most common of which is network issues. If the network connection between the shared printer and the printer is unstable or interrupted, normal operation will not be possible.

1. Place the earphones in the earphone box and keep the lid open. Press and hold the button on the box to enter the pairing state of the earphones. 2. Turn on the watch music function and select Bluetooth headphones, or select Bluetooth headphones in the watch settings function. 3. Select the headset on the watch to pair successfully.
