218

I've tried deleting skype but that didn't work, I've tried turning off the world wide web thing off, IIS off nothing seems to work.

12:51:22 PM  [Apache]   Problem detected!
12:51:22 PM  [Apache]   Port 80 in use by "Unable to open process" with PID 4!
12:51:22 PM  [Apache]   Apache WILL NOT start without the configured ports free!
12:51:22 PM  [Apache]   You need to uninstall/disable/reconfigure the blocking application
12:51:22 PM  [Apache]   or reconfigure Apache and the Control Panel to listen on a different port
starball
  • 20,030
  • 7
  • 43
  • 238
user3097839
  • 2,191
  • 3
  • 12
  • 4
  • 2
    No I ment to type it on here, not everyone knows everything about computers. I was asking for help, i've googled it and everything people say to do doesn't work. – user3097839 Dec 13 '13 at 06:31
  • Ah, this makes more sense now. Try http://www.petri.co.il/quickly_find_local_open_ports.htm to find out who is blocking port 80 – Pekka Dec 13 '13 at 14:09
  • 9
    @Pekka I've been working with computers since not long after I stopped crapping in diapers, I've been a programmer as well now for almost a decade, and I googled this question and thankfully because the persons asking and answering this question USE this site, I quickly found the answer. Although this probably should be migrated to superuser, badgering people and making them feel stupid for asking a legitimate question is contrary to how this community functions. I suggest you find some other purpose in life. –  Mar 04 '14 at 08:34
  • 3
    Well I'm not sure where this result was produced during your search, but in my search, thanks to this thread, this was top of the list. That's precisely what this community strives to be, a highly visible and well known knowledge base for this kind of stuff. So while I appreciate what you're saying, in reality, mission accomplished thanks to the OP. –  Mar 04 '14 at 17:52
  • @TechnikEmpire but the fact that this question is now a high-ranking Google result is part of the *problem,* not the solution. The Google result already contained great answers before this question came into existence - I checked before making the comment, I always do. Those answers may now have been pushed down by this question, because of SO's immense clout with Google. See also discussion here: http://meta.stackexchange.com/questions/160565/general-reference-questions-create-low-quality-dead-ends-for-googlers – Pekka Mar 05 '14 at 19:38
  • Try `net STOP http` from **PROMPT with ADMIN** is work fine. – KingRider Jul 28 '16 at 17:54

29 Answers29

425
  1. Open a CMD prompt as administrator and execute the following command:

    net stop was /y
    
  2. Open the Run dialog box (press Win+R), then type: services.msc

    Then search for World Wide Web Publishing Service (WWW-Publishing Service) and Web Deployment Agent Service and stop them. You should also disable them.

  3. Start Apache again with XAMPP :)

Link Ref: https://www.sitepoint.com/unblock-port-80-on-windows-run-apache/

Pang
  • 9,564
  • 146
  • 81
  • 122
Vo Quoc Cuong
  • 4,448
  • 1
  • 14
  • 6
155

Another very easy option is to simply set Apache to listen on a different port. This can be done by clicking on the "Config" button on the same line as the "Apache" module, select the "httpd.conf" file in the dropdown, then change the "Listen 80" line to "Listen 8080". Save the file and close it.

Now it avoids Port 80 and uses Port 8080 instead without issue. The only additional thing you need to do is make sure to put localhost:8080 in the browser so the browser knows to look on Port 8080. Otherwise it defaults to Port 80 and won't find your local site.

This will also require you to restart Apache for the change to take effect.

Voila! Fixed.

gtr1971
  • 2,672
  • 2
  • 18
  • 23
  • I got force upgraded to Windows 10 and it broke my XAMP install, this answer fixed it for me. Thanks! – Ian Jun 16 '16 at 04:19
  • This worked for me too, except I exited out of everything, clicked on xampp_start in `C:/xampp` and then changed it to port 81. 8080 didn't work for me. – user3553260 Oct 04 '16 at 20:41
  • 2
    I recommend your solution. In my case I need to develop ASP .NET Application and PHP. If i stop `World Wide Web Publishing Service` i can't work on my ASP application. SO changing the port is solution for me. Thanks! – mihkov Nov 17 '16 at 13:44
  • 3
    In additional the httpd.conf file, you may also need to also change the port from "Config" > "Service and Port Settings". On the "Apache" tab, change the "Main Port" value to the new port – Ian A Jun 21 '17 at 08:23
52

In httpd.conf change the following lines and then restart the application:

  • Listen 80 to Listen 8080
  • ServerName localhost:80 to ServerName localhost:8080

When you press "Start" the application can still say that you have an error like "Port 80 in use by "Unable to open process" with PID..." but it will still work.

If the error includes "Port 443 in use by "Unable to open process" with PID..." you need to change both httpd.conf and httpd-ssl.conf.

In httpd-ssl.conf change:

  • Listen 443 to Listen 4433
  • <VirtualHost _default_:443> to <VirtualHost _default_:4433>
  • ServerName www.example.com:443 to ServerName www.example.com:4433
Ogglas
  • 62,132
  • 37
  • 328
  • 418
  • I ended up having to do this on my issue. goodness! that PID is by the system. – mzimhle Dec 27 '19 at 13:33
  • Indeed. After I change port, and then close XAMPP and reopen it still shows red error message, however everything works. Apparently, XAMPP does not check if port has been reconfigured before displaying that error message.It only checks if port is in use. – Vanity Slug - codidact.com Mar 29 '21 at 17:12
43

Extracted from this article:

  1. Go to your run command and enter:

    netstat -o -n -a | findstr 0.0:80

The last number here is the process ID using it. This is most often IIS or other web relates service and is easy to resolve, but every so often (very often it would seem looking around on google) it appears to be PID 4 – which according to the Windows Task Manager is the NT Kernel and System. Not very helpful given killing this will result in a blue screen of death.

The thing hogging port 80 has nothing to do with IIS or web anything, it's SQL Server Reporting Services. Turn off anything that resembles a SQL Server Services and start Apache again, no need for a reboot.

So problems with PID 4 listening to port 80? Check your SQL services and turn them off.

UPDATE - Comment from @sangam:

Worked at a shot. In my case, it turned out to be SQL server reporting services. I stopped the service for all the installed instances, and it worked (without machine reboot).

Richard
  • 4,341
  • 5
  • 35
  • 55
chridam
  • 100,957
  • 23
  • 236
  • 235
38

So I have faced the same problem when trying to start Apache service and I would like to share my solutions with you. Here are some notes about services or programs that may use port 80:

  1. Skype: Skype uses port 80/443 by default. You can change this from Tools -> Options -> Advanced -> Connections and disable the checkbox "use port 80 and 443 for addtional incoming connections".

  2. IIS: IIS uses port 80 be default so you need to shut it down. You can use the following two commands: net stop w3svc, net stop iisadmin.

  3. SQL Server Reporting Service: You need to stop this service because it may take port 80 if IIS is not running. Go to local services and stop it.

  4. VMware Workstation: If you are running VMware Workstation, you need to stop the VMware Workstation server - port 443 as well.

These options work great with me and I can start Apache service without errors.

The other option is to change Apache listen port from httpd.conf and set another port number.

Hope this solution helps anyone who faces the same problem again.

felipeptcho
  • 1,377
  • 2
  • 9
  • 23
Peter T.
  • 8,757
  • 3
  • 34
  • 32
33

You might need to stop the "Web Deployment Agent Service"

Press Win+R and type services.msc

Right click on Web Deployment Agent Service and select "Stop"

Restart XAMPP

Also after double clicking "Web Deployment Agent Service" you can make the Startup type to Manual, So that "Web Deployment Agent Service" will not start automatically

Jerry Abraham
  • 1,039
  • 18
  • 42
Stephen Burrows
  • 470
  • 5
  • 5
10

As there is comment by @johnkarka on the question, this port is used by SQL Server reporting service as well. After stopping this, Apache started fine.

  1. Go to "SQL Server Configuration Manager"
  2. Click on "SQL Server Reporting Service" and stop it

enter image description here

The funny thing is IIS was working fine in same configuration but not Apache, had to stop SQL Reporting service to make it work on default port (80).

TheTechGuy
  • 16,560
  • 16
  • 115
  • 136
9

After changing the main port 80 to 8080 you have to update the port in the control panel: enter image description here Then click here: enter image description here And here: enter image description here Then save and restart.

Zeke
  • 562
  • 4
  • 14
7
  1. Open Task Manager (Ctrl+Alt+Delete).
  2. Go to "Details" tab.
  3. Sort by PID number.
  4. End process that is using PID number indicated in error.
  5. Restart XAMPP.
wmcnally
  • 147
  • 2
  • 14
4

What worked for me was stopping the Internet Information Services (IIS). If you are using Windows 7, click on your Start button and in your search box, type "iis". Click on "Internet Information Services (IIS) Manager". When the window pops up, and assuming you've got none of the icons selected, you should just be able to click Stop on the right action pane. My XAMPP Apache started right up. Hope it all worked out for you.

midoriha_senpai
  • 177
  • 1
  • 16
3

In windows 10, to free up port 80:

in my case, I open "Services" from "Search Windows" (on the left corner on screen), then stop all of SQL server services MSSQLSERVER and it works again

N.P
  • 54
  • 2
3

I had this problem too and stoping services using port 80 didn't helped. I resolved it by following this procedure (found on a french board):

  1. Launch RegEdit
  2. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
  3. Change the value of "start" to 4 (disabled)
  4. Reboot your computer

Not sure how this affect other services, but it solved permanently the issue and so far I didn't see any issue.

Using Windows 10.

vard
  • 4,057
  • 2
  • 26
  • 46
2

If you've SQLServer Reporting Services running locally then you need to stop that also..

Senthil
  • 1,499
  • 16
  • 17
2

I've had the same problem, but in my case Apache was already running and for some reason the XAMPP config tool didn't show that. It happened after I started XAMPP for the first time after the installation. After crashing the other Apache instances all was fine and ports 80 and 443 were free again.

So before making changes to your systeem, make sure something as obvious as the above isn't happening.

magnetronnie
  • 505
  • 3
  • 16
2

"SQL Server Reporting Service" was causing issues in my system, after stopping it, Apache started working fine

ramya
  • 2,350
  • 6
  • 31
  • 57
2

I have the same issue, I solved the problem, just disabled

"BranchCache Service" in services.

Somehow windows updates, this service is triggered in startup, and uses 80 ports. When you check via netstat you could see the system is used this but couldnt understand which service is used.

Günay Gültekin
  • 4,486
  • 8
  • 33
  • 36
1

Click services on the Xampp control panel (filename is services.msc, extra info).

First, look for IIS, if it is running. Stop it (stop this service option on the left after clicking on the service name.). Then, this is the main problem, Look for Web deployment Service (not the exact name though it has Web deployment at the beginning.). Stop this service too. Try again and Apache should work.

If you are running Skype, exit out of that too, run Apache, then launch Skype

rassa45
  • 3,482
  • 1
  • 29
  • 43
  • Normally, Skype hogs up port 80 but is smarter than XAMPP and will use a different port once it realizes that 80 belongs to Apache Server – rassa45 Jun 12 '15 at 01:03
1

I've had same problem, when I was installed MS WebMatrix, IIS Server was blocked the port 80 which XAMPP was running on. I tried to find World Wide Web Publishing Service and stop it, but could not find it on list. Best way is changing a port.

Please refer with this
link ref.

rango
  • 609
  • 1
  • 7
  • 23
1

For those with ASP.NET, C# or having SQL Server users, If you are using SQlServer OR Visual Studio Your port might encounter. easiest thing you might want to do is on Command> servies.msc and then find SQl Server Reporting Service and then stop it.

0

if the service is http.sys

You need to change the binded IP address for http.sys

netsh http add iplisten ipaddress=::

Work fine without restart the os.

mik3fly-4steri5k
  • 712
  • 3
  • 15
  • 32
0

The Web Deployment Agent Service is deployed with WebMatrix and was the cause of my woes. It may also be distributed with other applications installed using Microsoft’s Web Platform Installer.

Uninstall it solved my problems!

0

For me usually works: - Turn off Skype - Turn off all SQL Server processes displayed in services.msc - Turn off World Wide Web Publishing in services.msc

Iwona Kubowicz
  • 364
  • 3
  • 15
0

It usually works afters you stop IIS Server and Skype

N A
  • 831
  • 2
  • 8
  • 28
0

XAMPP - Port 80 in use by “Unable to open process” with PID 4! 12

run the comment in cmd tasklist

and find which the PID and process name related to this now open window task manager

you can also open window task manager by using CTRL+ALT+DEL

now click on the process tab and find the name which using PID and right click on that and end process

now again restart the xampp

Surendra Kumar Ahir
  • 1,609
  • 18
  • 19
0

I had same issue. After some googling arrived to this page. Since I guess this error may have various reasons, so listen to my experience:

Xampp red line log:

12:53:54 PM  [Apache] Problem detected!
12:53:54 PM  [Apache]   Port 443 in use by "Unable to open process" with PID 3908!
...

Finally it turned out that I had this line of code in my php codes :

$res = file_get_contents("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");

The purpose of this piece of code was to get a mirror of php result from somewhere in my server. But it's just stucked in a loop that gets its own content!

I repaired code:

$res = file_get_contents(str_replace("my_uri.php" , "mirror_uri.php" , "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"));

Then I restarted apache ... and that apache error never happened again.

So sometimes searching for probable halting points in your code is a good approach.

Hossein Khalesi
  • 111
  • 1
  • 7
0

In Ubuntu by default, the system will not allow you to occupy privileged ports [ 0 to 1023], other than specifying the port as 80, you need to run XAMP with sudo.

Arun Joseph
  • 2,736
  • 25
  • 35
0

This solution works for me.

I am on Windows 11 and I have a port 80 issue because of Nginx server was running on port 80.

port 80 and 443 issue

These are the steps that I have followed to resolve the issue.

  1. Go to Shell from XAMPP Control Panel Open Shell From Xampp
  2. Run this command to stop Nginx Server @taskkill /f /im nginx.exe
  3. After the success message you can close the shell window and restart the Apache server.
Junaid Ahmed
  • 720
  • 1
  • 7
  • 15
0

By default, XAMPP will check default ports on startup, even if you have already changed Apache's default listening port in "C:\xampp\apache\conf\httpd.conf" to anything other than port 80;

To prevent it:

  1. Go to XAMPP Control Panel > Config
  2. Uncheck "Check default ports on startup"
Kia Faraji
  • 17
  • 4
-1

I write this, because i coudn't find answear for the same question. In my case PID was 2484.

  1. you must find a process or service with this PID: open cmd (in Windows) and write:

    tasklist
    
  2. Find your PID in this list and read name of process or service.

  3. Now you can kill this using Task Manager

  4. find this name on Process list

  5. click End Process.

That's my case. Possibly you must open services.msc and stop Service with your PID.

On my computer xampp it worked fine :)

davejal
  • 6,009
  • 10
  • 39
  • 82