Windows

Fix Apache cannot start because port 80 is already in use on XAMPP

The error in your XAMPP log says:

Port 80 in use by "Unable to open process" with PID 4!
Apache WILL NOT start without the configured ports free!

This means Apache cannot start because port 80 is already in use by a System process (PID 4) — typically reserved for internal Windows services.


Step-by-Step Solution

Option 1: Change Apache Port to 8080 (Quick & Safe Fix)

  1. Open XAMPP Control Panel

  2. Click Config next to Apache → select httpd.conf

  3. Find this line:

    Listen 80

    Change to:

    Listen 8080
  4. Scroll down to:

    ServerName localhost:80

    Change to:

    ServerName localhost:8080
  5. Save & close the file.

  6. Restart Apache.

Now access your site using:
http://localhost:8080


Option 2: Stop the service that uses port 80 (advanced)

  1. Open Command Prompt (Admin)
    Run:

    netsh http show servicestate
  2. Look for:

    Listen URL: http://+:80/
    Registered by: <service name>
  3. If you see something like:

    Registered by: Windows Remote Management

    Or

    Web Deployment Agent Service

    You can disable that service in services.msc:

    • Press Windows + R → type services.msc

    • Find the service

    • Right-click → Stop

    • Right-click again → Properties → Set to Disabled


Option 3: Use TCPView (by Microsoft) to find the exact service

  1. Download TCPView: https://learn.microsoft.com/en-us/sysinternals/downloads/tcpview

  2. Run the app

  3. Sort by Local Port → find port 80

  4. See which service/process is using it

You can right-click → "Kill Process" (if safe) or use the name to disable the service in services.msc.


Recommended: Use Port 8080 Unless You Need Port 80

Port 80 is often protected by Windows or used by services like IIS, SQL Reporting Services, etc. If you're just testing websites locally, using port 8080 is a safer and easier long-term solution.

Thanks for visit my website