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

Solution 1:

  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/

Solution 2:

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.

Solution 3:

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

Solution 4:

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).

Solution 5:

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.