Troubleshooting “Port 80 in use” issue
By Anash P. Oommen


Overview

 

“Port 80 in use” is a common but frustrating error that can catch a new web developer unguarded. This article describes how to troubleshoot this error on a Windows XP machine.

 

Symptoms

 

When you try to start Apache web server on your machine, you get the following error:

 

(OS 10048)Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down
Apache could not be started
Press any key to continue . . .



Figure 1  Apache cannot run on port 80


The reason for this error is that some other application is already using port 80. Only one application can listen to a port at a given time, so Apache fails to bind to this port. As port 80 is the default port for http, the most likely reason is that another web server (like IIS) is running on your machine. However, some other applications may also block port 80. One good example is Skype.


Resolution


Find the process blocking port 80


This is often simple, most of the time you can guess the application, as a web server (like IIS) is the usual suspect. If you don’t know which process is blocking the port, do the following steps:


a.  Open a command prompt and type netstat –anb. This will give you the list of all processes listening on various ports on your machine.
b.  Look for the application using port 80. On my machine, this is inetinfo.exe.



Figure 2 – Find the blocking application using NetStat


c.  At times, the process name may not be displayed. In this case, note the process ID (PID column). Process ID is the unique number that Windows uses to identify any process running on a computer. In my case, it is 292.
d.  Now open the Windows Task Manager. Choose the process id column from View->Select columns, as shown below



Figure 3A – Select columns within Windows Task Manager



Figure 3B – Choose the PID (Process Identifier) column and click OK.



Figure 3C – Find the blocking process in Windows Task Manager.


e.  If you are still not sure about the process, just do a google search on the process name, or visit a site like Uniblue ProcessLibrary (http://www.liutilities.com/products/wintaskspro/processlibrary/) to search for the process.


Stop the process blocking port 80


This is the obvious workaround for the problem. For example, if you want to stop IIS,


a.  Open Start Menu ->Control Panel
b.  Open Administrative Tools
c.  Open Internet Information Services
d.  Select Web Sites->Default WebSite e. Click the "Stop button" on the toolbar



Figure 4 – Stop IIS

Reconfigure Apache to run on a different port

 

You might want to pick this path if you don’t want to close the application blocking port 80. A typical reason might be that you want to run say, Apache and IIS on the same machine at the same time.

 

1.    To configure Apache to run on a different port, open <your apache folder>/conf/httpd.conf in notepad. Search for the following lines:

a.  Listen 80
b.  ServerName localhost:80

Change both these lines, so as to have a different number instead of 80. I have chosen 8000 instead of 80. Make sure that this is a free port, not used by any applications.

a.  Listen 8000
b.  ServerName localhost:8000


Figure 5
– Reconfiguring Apache (httpd.conf)


2.  Now start Apache. It should start successfully. Your default website should be available at http://localhost:port


Reconfigure the blocking application


Sometimes, you might want to reconfigure the blocking application instead of Apache itself. The approach to pick here depends on the application you are trying to reconfigure. For example, if you want to reconfigure IIS to run on a different port, this is how you go about doing it:

a.  Open the IIS interface, as discussed above.
b.  Right click Default Website and select Properties

 


Figure 6A Open Properties for Default Website (IIS)



Figure 6B Properties dialog for IIS Default Website.


c.  Change the IIS port from 80 to some other value and click OK.

d.  Now Start IIS. It should start successfully. Your default website should be available at http://localhost:port


Comments