This article will introduce you to the Windows system to check port occupation and solve port occupation. If you have any need to know about it, please do not go to the reference page.
I believe that PHP developers often get angry that port 80 is occupied by some other services. In the absence of an effective method, you can only restart apache or nginx, or delete software that may occupy port 80.
In fact, we don't have to be so nervous.
The solution is as follows:
1. Check the program that occupies port 80:
Open the command prompt, Enter cmd in the run, and then execute the following command:
Netstat-ano | findstr 80: Search for processes using port 80.
Anyone who has some common knowledge knows that a program corresponds to a process. After finding the process, you will know what the corresponding program is. Then, we can directly end the process.
The command execution line outputs a list. The last column of the List is PID.
TCP 0.0.0.0: 80 0.0.0.0: 0 LISTENING 2060
TCP 0.0.0.0: 8800 0.0.0.0: 0 LISTENING 924
TCP 0.0.0.0: 49153 0.0.0.0: 0 LISTENING 1080
TCP 0.0.0.0: 49162 0.0.0.0: 0 LISTENING 680
TCP 192.168.100.111: 80 192.168.100.111: 54888 TIME_WAIT 0
TCP 192.168.100.111: 49422 123.58.182.253: 80 ESTABLISHED 5632: the last line is displayed. A program with process ID 5632 occupies port 80.
2. Find the program by using PID:
@ Open the task manager and click the "process" tab. If the PID Column cannot be found, open it as follows:
Task Manager-View-Select column-select PID.
Find the PID 5632 and end the process.
In this way, the port occupation problem is solved. Of course, we need to restart apache or nginx again.