Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

XAMPP Apache will not start: shutdown unexpectedly, port blocked

ErrorError: Apache shutdown unexpectedly.

Short answer

Apache cannot share a port. If something else already listens on port 80 or 443, XAMPP shows Apache shutdown unexpectedly. Find the process on the port and stop it (IIS and Skype are the usual ones), or change Listen in httpd.conf to another port such as 8080. Then read error.log if it still fails.

  • Applies to XAMPP for Windows, Apache 2.4, Windows 10, Windows 11
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out which program already owns port 80 and 443. Run this in an Administrator Command Prompt.

    netstat -ano | findstr ":80 :443"
    tasklist /FI "PID eq <PID from the last column>"
  2. 2Match what you see, then jump to its fix

    1. 1The process on port 80 is System (PID 4) or w3wp/inetinfo.IIS or the World Wide Web Publishing Service holds port 80Fix
    2. 2tasklist names Skype or another client application for the PID on port 80.Skype or another program uses port 80Fix
    3. 3You cannot or do not want to stop the program on port 80.Keep the other program and move Apache to another portFix
    4. 4Nothing listens on 80 or 443, and Apache still stops at once.The port is free but the configuration is brokenFix
    5. 5(48)Address already in use: make_sock: could not bind to address [::]:80Overlapping Listen lines, or an old httpd still runningFix

What does the error look like?

  • Error: Apache shutdown unexpectedly.
  • make_sock: could not bind to address

Cause 1 of 5

IIS or the World Wide Web Publishing Service holds port 80

1Check

Windows 10 can start Microsoft IIS on port 80 by default. Open Services and look at World Wide Web Publishing Service.

services.msc

2Fix

In Services, select World Wide Web Publishing Service, click Stop, set its startup type to Disabled (as the XAMPP FAQ describes), then start Apache again.

services.msc

3Verify

Start Apache from the XAMPP Control Panel; it turns green.

netstat -ano | findstr ":80"

Confirmed by apachefriends.org

Did this fix it?

Cause 2 of 5

Skype or another program uses port 80

1Check

Some client applications, Skype among them, take port 80. Only one server can use a port.

tasklist /FI "PID eq 1234"

2Fix

Close the program, or in Skype turn off the option that uses ports 80 and 443 as alternatives, then restart it.

taskkill /PID 1234 /F

3Verify

Start Apache again.

netstat -ano | findstr ":80"

Confirmed by httpd.apache.org

Did this fix it?

Cause 3 of 5

Keep the other program and move Apache to another port

1Check

Open Config > httpd.conf in the Control Panel and read the Listen line (default 80).

findstr /B /C:"Listen" C:\xampp\apache\conf\httpd.conf

2Fix

Change Listen to a free port and add that port to every URL you open.

Listen 8080

3Verify

Start Apache and browse to the new port.

curl -I http://localhost:8080/

Confirmed by httpd.apache.org

Did this fix it?

Cause 4 of 5

The port is free but the configuration is broken

1Check

The Windows service wrapper hides the real message. Run the server in a console, test the config, then read logs/error.log.

cd C:\xampp\apache\bin
httpd.exe -t
httpd.exe

2Fix

Fix what the console or error.log names (a bad directive, a wrong path, a duplicate Listen line), then start Apache again.

type C:\xampp\apache\logs\error.log

3Verify

httpd.exe -t reports Syntax OK, and Apache stays green.

httpd.exe -t

Confirmed by httpd.apache.org

Did this fix it?

Cause 5 of 5

Overlapping Listen lines, or an old httpd still running

1Check

Search httpd.conf and the extra config files for several Listen lines for the same port, and list running httpd processes.

findstr /S /B /C:"Listen" C:\xampp\apache\conf\*.conf
tasklist | findstr httpd

2Fix

Keep one Listen line per port, end the stray httpd.exe, and stop and start the server fully (a restart keeps the old ports bound).

taskkill /IM httpd.exe /F

3Verify

Start Apache from the Control Panel.

netstat -ano | findstr ":80"

Confirmed by httpd.apache.org

Did this fix it?

How do I stop it coming back?

  • Keep IIS and the World Wide Web Publishing Service disabled on a development machine that runs XAMPP.
  • Choose a non-standard port (8080) for XAMPP from the start if other tools need port 80.
  • Run httpd.exe -t after every edit of httpd.conf.
  • Check logs/error.log first; the Control Panel message is generic.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Related fixes

Back end

ng serve says it cannot determine the project or target

Cannot determine project for command.

The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.

3 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.