We areWebsite constructionWhen starting the Apache server after completion, we often find that the port 80 we need to use is occupied by other programs, but we don't know who is occupying it. At this time, we need to find out the "real culprit". How do we do it?
View the port occupation on the Mac system:
1. Open the terminal input in the utility:
sudo lsof -i:3307
It is seen that port 3307 is occupied by MySQL, and the pid is 95.
2. Kill process according to PID
sudo kill -9 95
Windows View Port Occupancy:
1. Start -->Run -->cmd, or press window+R to call up the command window
2. Enter the command netstat - ano to list all ports.In the list, we can observe the occupied port, such as 49157, and find it first.
3. View the PID corresponding to the occupied port, enter the command: netstat - aan | findstr "49157", enter, and record the last digit, that is, PID. Here is 2720
4. Continue to enter tasklist | findstr "2720" and press Enter to check which process or program occupies port 2720. The result is: svchost.exe
5. Or we can open the task manager, switch to the process tab, and view the process corresponding to the 2720 in the PID column. If the PID column is not visible, see the following figure:
6. Then we click View -->Select Column, tick the PID (Process Identifier), and click OK.
7. In this way, we can see the ID column of PID, and see who the process corresponding to 2720 is. If not, we can check the following process that shows all users. The image name is svchost.exe, and the description is that the main process of Windows is exactly the same as the above command.
8. To end the process: select the process in the task manager and click the "End Process" button, or enter: taskkill/f/t/im Tenantdl.exe in the command window of cmd.