Apache server Installation failed(Port 80 or 443 already in use)

Apache server Installation failed(Port 80 or 443 already in use)

  1. Blog
  2. 15 November 2026
  3. 4 min read

Stefan Bogdanescu

Founder & Senior Architect

Apache Server Installation Failed: Port 80 or 443 Already in Use

When installing XAMPP on a Windows machine that already hosts Internet Information Services (IIS), the installation wizard often halts with an error stating that port 80 or 443 is already in use. This isn't necessarily a bug in XAMPP; it is a direct consequence of how Windows handles network sockets and how IIS defaults to occupying those specific ports. Even if you have successfully stopped the IIS service via the net stop w3svc command, the underlying socket binding often remains locked, preventing Apache from starting on the same port.

The core issue lies in the state of the TCP/IP stack. When a process binds to a port and then terminates, the operating system marks that port as being in the TIME_WAIT or CLOSE_WAIT state for a brief period before fully releasing it. However, in cases involving IIS, the service might not have fully cleaned up its bindings, or a third-party application is silently holding the port open.

Identifying the Culprit Process

Before attempting to reconfigure Apache to use alternative ports like 8080, you should verify which process is actually holding the port. On Windows, the most reliable way to do this is using the Resource Monitor or command-line tools.

Open Command Prompt as an administrator and run the following command:

netstat -ano | findstr :80

This will list all processes listening on port 80 along with their Process IDs (PID). Look at the last column to identify the PID. Once you have the PID, you can inspect the process details:

tasklist /fi "PID eq [YOUR_PID]"

If the output shows httpd (Apache) or w3wp.exe (IIS Worker Process), you know exactly who is blocking the port. If it shows something unexpected, such as Skype or another application, that explains why simply stopping IIS didn't resolve the issue initially. Note that modern versions of Skype and some other apps do not always release port 80 immediately upon closing; they may keep a background listener active.

Clearing the Port Lock

If you confirm that IIS is the source of the conflict, restarting the service is often insufficient because the socket remains bound. You need to force the system to release the port.

  1. Stop the Services: Ensure both the World Wide Web Publishing Service and the HTTP Service are stopped using services.msc or PowerShell commands like net stop w3svc.
  2. Restart the Computer: While a reboot seems drastic, it is often the most effective way to clear lingering socket bindings on Windows that refuse to release after a service restart. This guarantees the port is truly free before Apache attempts to bind to it.

Configuring Alternative Ports

If you cannot stop IIS or prefer not to reboot, the pragmatic solution is to configure XAMPP to run on non-standard ports. Apache and MySQL are highly configurable and will happily operate on ports 8080 for HTTP and 3307 for MySQL without issue.

To change the port:

  1. Navigate to the XAMPP installation directory, typically C:\xampp.
  2. Open httpd.conf located in the \apache\conf\ folder using a text editor like Notepad or VS Code.
  3. Locate the line Listen 80. Change it to Listen 8080.
  4. Find any ServerName directives that might reference port 80 and update them if necessary, though this is rarely required for local development.
  5. Open my.ini in the \mysql\bin\ folder and change port=3306 to port=3307.

After making these changes, start XAMPP again via the control panel. The Apache module should now start successfully on port 8080, allowing you to develop locally without conflicts with your existing IIS infrastructure.

Trade-offs and Considerations

Using non-standard ports is a standard practice in development environments. However, it introduces a slight friction when sharing your local site with colleagues or accessing it from other devices on the network. By default, Windows Firewall will block incoming connections to port 8080 unless you explicitly allow traffic through. You must add an inbound rule in Windows Defender Firewall for Apache HTTP Server to listen on the new port.

Furthermore, if you intend to deploy a Laravel application later, be aware that while local development on port 8080 is convenient, production servers typically expect port 80 or 443. Many hosting providers and reverse proxies (like Nginx) are configured to forward traffic from port 80/443 to your application's internal port. Keeping your local stack flexible by using non-standard ports ensures you don't break these configurations when moving code to production.

For those building high-performance PHP applications with Laravel, understanding how to isolate the development environment from the host OS services is crucial. If you need further guidance on configuring your local stack for specific framework requirements or deploying Laravel applications to various environments, resources like https://laravelcompany.com offer detailed documentation and community support.

Our network