Home > PHP Framework > Workerman > body text

What should I do if workerman cannot be used?

藏色散人
Release: 2019-12-18 15:17:59
Original
2373 people have browsed it

What should I do if workerman cannot be used?

What should I do if workerman cannot be used?

workerman startup failure phenomenon 1

The error reported after startup is similar to the following: php start.php start

PHP Warning: stream_socket_server(): unable to connect to tcp://xx.xx.xx.xx:xxxx (Address already in use) in ...workerman/Worker.php on line xxxx

Keywords: Address already in use

Reason for failure:

The port is occupied and cannot be started.

You can use the command netstat -anp | grep port number to find out which program occupies the port. Then stop the corresponding program to release the port solution.

If you cannot stop the program corresponding to the port, you can solve the problem by changing the worker port.

If the port occupied by Workerman cannot be stopped through the stop command (usually caused by the loss of the pid file or the main process being killed by the developer), you can kill the Workerman process by running the following two commands. killall php

ps aux|grep WorkerMan|awk '{print $2}'|xargs kill -9

If there is indeed no program listening to this port, then the developer may have set it in workerman There are two or more monitors, and the monitor ports are the same. Developers are asked to check whether the startup script monitors the same port. Phenomenon 2

The error reported after startup is similar to the following: PHP Warning: stream_socket_server(): unable to connect to tcp://xx.xx.xx.xx:xxx (Cannot assign requested address) in ...workerman/ Worker.php on line xxxx

or PHP Warning: stream_socket_server(): unable to connect to tcp://xx.xx.xx.xx:xxxx (The requested address is invalid in its context) in ...workerman/Worker.php on line xxxx

Keywords: Cannot assign requested address or the requested address is invalid

Cause of failure:

The startup script monitoring ip parameter is written incorrectly. It is not the local ip. Please fill in the local ip or fill in 0.0.0.0 (indicating that all ips of the local machine are monitored) to solve the problem.

Tip: In Linux systems, you can use the command ifconfig to view all network card IPs of the machine.

If you are a cloud server (Alibaba Cloud/Tencent Cloud, etc.) user, please note that your public network IP may actually be a proxy IP (such as Alibaba Cloud's private network), and the public network IP does not belong to the current server, so it cannot be monitored through the public network IP. Although you cannot use public network IP to monitor, you can still bind through 0.0.0.0. Phenomenon 3Waring stream_socket_server has been disabled for security reasons in...

Failure reason:

stream_socket_server function is disabled by php.ini

Solution

1. Run php --ini to find the php.ini file

2. Open php.ini and find the disable_functions item, and delete the stream_socket_server disabled item. Phenomenon 4PHP Warning: stream_socket_server(): unable to connect to tcp://0.0.0.0:xxx (Permission denied)

Failure reason

If the listening port under Linux is less than 1024, root permission is required.

Solution

Use a port greater than 1024 or use the root user to start the service.

Recommended: workerman tutorial

The above is the detailed content of What should I do if workerman cannot be used?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!