146

I installed XAMPP 1.6.8 and for some reason it didn't work. Later realized port 80 is not free or not listening. How can I release it or make it free?

Thanks a lot!

informatik01
  • 16,038
  • 10
  • 74
  • 104
  • http://stackoverflow.com/a/16251034/1339004 – amin k Apr 29 '13 at 09:31
  • http://stackoverflow.com/questions/750604/freeing-up-a-tcp-ip-port – mateuszb Jul 12 '13 at 14:09
  • I believe this is a duplicate question of (please find answer there) -> http://stackoverflow.com/questions/1430141/port-80-is-being-used-by-system-pid-4-what-is-that – Dung Mar 29 '17 at 17:08
  • Duplicate or not. This is first hit on [Google](https://www.google.de/search?q=windows+free+port+80). – Bitterblue Mar 29 '18 at 15:22
  • Does this answer your question? [How can you find out which process is listening on a TCP or UDP port on Windows?](https://stackoverflow.com/questions/48198/how-can-you-find-out-which-process-is-listening-on-a-tcp-or-udp-port-on-windows) – Stephen Ostermiller Mar 04 '22 at 09:41

18 Answers18

141

I found out that what was taking over port 80 is http api service. I wrote in cmd:

net stop http

Asked me "The following services will be stopped, do you want to continue?" Pressed y

It stopped a number of services actually.

Then wrote localhost and wallah, Apache is up and running on port 80.

Important: Skype uses port 80 by default, you can change this in skype options > advanced > connection - and uncheck "use port 80"

starball
  • 20,030
  • 7
  • 43
  • 238
MoFarid
  • 1,560
  • 1
  • 17
  • 25
  • On Windows 7, I couldn't stop the processes due to "access denied", but it showed me names of the processes that would be killed if I had the rights (I didn't have rights for netstat -a -b). – Pavel V. Dec 04 '14 at 09:02
  • 2
    @PavelV. you should run command prompt with administrative rights. open start, and write in search "cmd" right click on cmd and select Run as administrator. – MoFarid Dec 05 '14 at 19:30
  • Just make sure to open CMD as Administrator, so that it has enough privileges. – Naser Nikzad Jul 20 '23 at 04:45
72

netstat -ano

That will show you the PID of the process that is listening on port 80. After that, open the Task Manager -> Processes tab. From the View -> Select Columns menu, enable the PID column, and you will see the name of the process listening on port 80.

Ben
  • 54,723
  • 49
  • 178
  • 224
Francisco
  • 892
  • 5
  • 2
  • 1
    This is good as there can be other processes with the same name. I am wondering if there is any kill command in windows that I can run against the found PID instead of doing it via task manager. – Sundeep Jun 26 '12 at 12:54
  • taskkill doesn't kill the task. Its still showing port 80 running. @Jijo – Aakash Thakur Nov 28 '17 at 06:00
  • 1
    can you try using /f /t at the end, it will forcefully kill the task, i am currently on a linux system, not verified – Jijo Nov 29 '17 at 12:28
49

I had this problem previously,

if you see the Task manager(after enabling the view for PID), you will find PID=4 is "port 80 in use by NT Kernel & System; "

Just go to

  1. Control Panel
  2. Programs
  3. Turn Windows features on/off
  4. check if the World wide web services under IIS is checked

If so, Uncheck and netstat(or TCPVIEW) again to see if 80 is free.

Bruno Bieri
  • 9,724
  • 11
  • 63
  • 92
Eswar Rajesh Pinapala
  • 4,841
  • 4
  • 32
  • 40
  • 3
    Win7: start-menu searching for "IIS" brings up the "IIS manager", where you can disable the server. – Philipp Sep 01 '14 at 13:40
  • 1
    This worked for me. I was trying to use nginx on windows and it wouldn't bind giving a `nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions)` error. There are lot of fixes mentioned online, but this was the most straightforward one. Did require a reboot for me. – User Jul 20 '21 at 22:18
44

netstat -a -b

Should tell you what program is bound to port 80

Ben
  • 54,723
  • 49
  • 178
  • 224
Chad Grant
  • 44,326
  • 9
  • 65
  • 80
  • 1
    it just gave me bytes , unicast etc etc. did not give what is bound on port 80. Did I miss anything? –  Apr 25 '09 at 06:35
  • 1
    I tried this and it said "the requested operation requires elevation" – createscape Sep 06 '15 at 00:39
  • You are GOD! **Bowing Down**, by this I was able to find the actual service name that had same Process ID with others, so couldn't figure out before the actual service to kill from task manager. Really Thanks! – divy3993 Jul 26 '20 at 12:37
  • 1
    For me it says: `can not obtain ownership information` - what now? – winklerrr Dec 22 '20 at 14:14
37

use netstat -bano in an elevated command prompt to see what apps are listening on which ports.

But Usually following applications uses port 80 in windows.

  1. IIS
  2. World Wide Web Publishing service
  3. IIS Admin Service
  4. SQL Server Reporting services
  5. Web Deployment Agent Service

Stop above applications if running and check!!!

  • Do you know by any means how to make sure that these services do not use port 80? – rahoolm Jan 07 '15 at 08:36
  • Dafuq it works, I have been stopped all HTTP services but still denied using 80 port. Now it's worked after check manually services Thanks a lot dude, god bless you – Bcktr Feb 07 '21 at 05:46
19

Use TcpView to find the process that listens to the port and close the process.

MMind
  • 1,845
  • 2
  • 17
  • 26
  • or you can use findstar in a batch file http://www.windowstechinfo.com/2015/05/how-to-check-whats-using-port-80-or-443-in-a-single-step-web-port-inspector.html – Aravinda May 02 '15 at 09:10
8

Other option to try is to stop SQL Server Reporting Services.

Kinjal Dixit
  • 7,777
  • 2
  • 59
  • 68
  • thanks, for me it was SQL Server Reporting Services (MSSQLSERVER) don't know why but when i terminate it by services console, process with pid 4 unbinded from 0.0.0.0:80 – Vladimir Shmidt Oct 27 '11 at 09:21
7

You can use net stop http it will display which process is using. Moslty world wide web services are using

Warwicky
  • 281
  • 4
  • 9
7

I was trying to install nginx from here - http://nginx.org/en/docs/windows.html

Going to http://localhost/ will show something, at least a proper "not found" message
This is because 80 is the default port, and it was taken by other processes.

Now run below command:

net stop http

    // Above command stopped below services  
    // - SSDP Discovery  
    // - Print Spooler  
    // - BranchCache  
    // - Function Discovery Resource Publication  
    // - Function Discovery Provider Host  

Now, going to http://localhost/ will fail with a broken link page message.

Main process was BranchCache
This process, after stopped, will restart in a few seconds.
So we need to run other commands we need soon, an example below:

// this will stop
net stop http

// immeidately run other command you want to
start nginx

Now, going to http://localhost/ gave me:

Welcome to nginx!

Hope that helps.

Manohar Reddy Poreddy
  • 25,399
  • 9
  • 157
  • 140
7

Try

netstat -anb -p tcp

that show ports and processes

Muhammad Hassaan
  • 7,296
  • 6
  • 30
  • 50
MBaas
  • 7,248
  • 6
  • 44
  • 61
  • My xampp Application status shows both apache and mysql state 1 start 1 service 1 But the browser still does not show up the localhost. why so? any pointers? :( –  Apr 25 '09 at 06:45
6

Type in "netstat -ano" into your command line. I saw that it was showing something for Local Address port 0.0.0.0:80.

My issue was because I had SQL Server Reporting Services on Port 80. So I followed these instructions and changed the port # from 80 to 81:

http://seankilleen.com/2012/11/how-to-stop-sql-server-reporting-services-from-using-port-80-on-your-server-field-notes/

Here is a picture of my command line AFTER I changed the port number for SQL Server Reporting Services:

enter image description here

If you are still having the same issue, read this forum:

http://forum.wampserver.com/read.php?2,66196,66233#REPLY

Gene
  • 10,819
  • 1
  • 66
  • 58
4

Skype likes to use port 80 and blocks IIS. That was my prob.

Marcelo Mason
  • 6,750
  • 2
  • 34
  • 43
4

I also had the same problem. net stop http didn't help and World wide web services option under IIS in Windows Control Panel was unchecked. So in XAMPP control panel I just checked the Svc checkbox near Apache start button (Install Apache as service) and rebooted Windows. And now each time Windows starts Apache is started automatically and occupies port 80 before any other service does. Worked for me!

user2513149
  • 850
  • 12
  • 15
4

Known Windows Services That Listen on Port 80

From Services Manager (run: services.msc), stop and disable these Windows Services which are known to bind to port 80.

Double click Service, and change ‘Startup Type’ to ‘Disabled’…

  1. SQL Server Reporting Services (ReportServer)
  2. Web Deployment Agent Service (MsDepSvc)
  3. BranchCache (PeerDistSvc)
  4. Sync Share Service (SyncShareSvc)
  5. World Wide Web Publishing Service (W3SVC)
  6. Internet Information Server (WAS, IISADMIN)

skype also using port 80 as default setting and you can uncheck it.

You might, or might not, have some of these Services installed and running.

In my case "SQL Server Reporting Services" was opening port 80.

MrSalesi
  • 377
  • 3
  • 17
  • 1
    Thank you, this fixed my problem. "SQL Server Reporting Services" was using port 90 for me as well. – borat Sep 03 '20 at 07:51
4

This is just a guess, but since port 80 is the conventional port for HTTP, you may have a webserver running on your system. Is IIS active?

If you are running IIS you may have the web farm service running. That was what was killing my xampp.

Community
  • 1
  • 1
Thomas L Holaday
  • 13,614
  • 6
  • 40
  • 51
  • 1
    No I dont have an IIS. I did use xampp before and it had worked. I guess some other service is sitting on port 80 and not allowing the re-install of Apache service on it. –  Apr 25 '09 at 06:29
  • 2
    Skype also likes to steal port 80, a common unexpected culprit! – Simon_Weaver Aug 16 '11 at 20:01
1

Identify the real process programmatically

(when the process ID is shown as 4)

The answers here, as usual, expect a level of interactivity.

The problem is when something is listening through HTTP.sys; then, the PID is always 4 and, as most people find, you need some tool to find the real owner.

Here's how to identify the offending process programmatically. No TcpView, etc (as good as those tools are). Does rely on netsh; but then, the problem is usually related to HTTP.sys.

$Uri = "http://127.0.0.1:8989"    # for example


# Shows processes that have registered URLs with HTTP.sys
$QueueText = netsh http show servicestate view=requestq verbose=yes | Out-String

# Break into text chunks; discard the header
$Queues    = $QueueText -split '(?<=\n)(?=Request queue name)' | Select-Object -Skip 1

# Find the chunk for the request queue listening on your URI
$Queue     = @($Queues) -match [regex]::Escape($Uri -replace '/$')


if ($Queue.Count -eq 1)
{
    # Will be null if could not pick out exactly one PID
    $ProcessId = [string]$Queue -replace '(?s).*Process IDs:\s+' -replace '(?s)\s.*' -as [int]

    if ($ProcessId)
    {
        Write-Verbose "Identified process $ProcessId as the HTTP listener. Killing..."
        Stop-Process -Id $ProcessId -Confirm
    }
}

Originally posted here: https://stackoverflow.com/a/65852847/6274530

FSCKur
  • 920
  • 7
  • 16
0

I faced the same issue and fixed it by making a small change in the httpd.conf file which can be obtained by clicking the config button along with the Apache option.

The change I made was to replace listen 80 with listen 8080.

Roberto Caboni
  • 7,252
  • 10
  • 25
  • 39
-1

For me, this problem began when I hosted a VPN-connection on my Windows 8 computer.

Simply deleting the connection from "Control Panel\Network and Internet\Network Connections" solved the problem.

Zar
  • 6,786
  • 8
  • 54
  • 76