How to solve the blockade of port 80?

2

Hello everyone I am new to web programming and like many people before uploading a web page you do tests in local, I use Xampp and until yesterday it worked perfect until today I tried to open it and it came out:

  

Apache: Problem detected!
Apache: Port 80 in use by "Unable to   open process "with PID 4!
Apache: WILL NOT start without the   configured ports free!
Apache: You need to   uninstall / disable / reconfigure the blocking application
Apache: or   reconfigure Apache and the Control Panel to listen on a different port

I've been reading and a solution is with CMD net stop was /y , but it does not work or I do not correctly if any can help me: '(, use win8.1 x64 in AMD, thanks in advance.

    
asked by user3423 14.02.2016 в 04:47
source

3 answers

2

The first thing is to use netstat and a few parameters from the console in windows ( -o shows the PID, -a all connections and -n ip addresses)

c:\Jack> netstat -oan

Then we already know whether or not it is in use .. right there with the parameter -o we can access the no. of process or PID .. already with that data we can open the task manager, that would be enough to know his name and kill him if it is what they need .. but if it is a global process and does not appear in the task manager, there is no another more than to continue using the console to find out where the hell the application that uses the port they need came from.

Well, the next thing is to know the name of the application that owns the process and for this we use the tasklist command with another pair of parameters ( -svc to get the name of the service, -FI to apply a search filter )

c:\Jack> tasklist /svc /FI "PID eq 1428"

In this case example I want to know the name of the application with PID 1428 which was what I found using netstat .. and the result of the tasklist execution is the name of the application.

To finish we will use the command taskkill sending as parameters -F to force the closure of the application and -PID to specify the number of the process to kill.

c:\Jack> taskkill /F /PID 1428

You would do exactly the same thing but with the process that is using port 80 Ref .

    
answered by 14.02.2016 в 05:23
0

Port 80 is the default port for the server to receive HTTP communication. Apparently you have another server installed on your computer that already uses this port. You have two options:

  • As indicated by Gemasoft in its response, you can search the process of the application (the process of the other web server) and close it. Thus, when you raise your Apache server you can run without problems since port 80 is free.

  • Change the port used by any of these applications. In this case, I would change the Apache port so that instead of pointing to port 80 it points to a different number. The port number can vary between 0 and 65536. Choose a number other than 80, for example 4000. In Apache, you can change the port number by modifying the link file that should be found in <ruta_instalación_xampp>/apache/conf ( <ruta_instalación_xampp> is usually C:\xampp , in my case it is not, so its value depends on the path where you have installed xampp) and look for the following lines:

    Listen 80
    # más líneas...
    ServerName localhost:80
    

    Change the number 80 to the port number you want. For this example, it would be 4000.

    Listen 4000
    # más líneas...
    ServerName localhost:4000
    

    As Apache is being raised by XAMPP, I recommend that you go to the Control Panel and select the Config option. In the window that appears, select the Ports and Services Configuration option. In the window that appears, select the tab Apache and change the main port to 4000. I leave the image as a reference:

    Now start your Apache server. I should run without problems. To access it and verify that it is running without problems, go to the following url:

    link (Note that now we have to indicate the port in the URL, since 80 is the default port, when you access http://localhost/ it's as if you access http://localhost:80/ )

    In case you do not want to change the Apache port, you can choose to change the port of the other application that uses port 80.

  • If you are in a controlled environment, say your personal work computer, and this is simply for learning, you can use the first option if you do not need the other application, and if you want both to live together you can use the second option. If you are in a slightly controlled environment where you only have control over Apache, I recommend the second option. If it is a production server, I would ask why you have another application that already listens to port 80 and would analyze the situation.

        
    answered by 14.02.2016 в 15:14
    0

    As you have already been told, you have the port blocked because another application is using it. You can try to change the port in the configuration of XAMPP (or apache in its default) and / or search through "netstat" the application that is blocking it. In my case, it was that apache had not been closed when I ordered the shutdown for Xampp control, and I had to restart the computer. (You will have restarted, right?)

        
    answered by 03.03.2016 в 11:16