XAMPP - Apache could not start - Attempting to start Apache service

While trying to start Apache using XAMPP, I was receiving - "Attempting to start Apache service..." message in XAMPP UI. No further details were available.

Where can I see the logs (I was running XAMPP as Admin) ?

Apache - Fails to start


Solution 1:

IF PORT 80 IS NOT THE ISSUE!

Check to see if the port 80 is in use first as this can be an issue. You can do this by typing "netstat -an" into cmd. The look for 0.0.0.0:80 under Local Address, if you find this is in use then follow the solution from @Karthik. However, I had a similar issue but my port 80 was not in use. My XAMPP had wrong paths locations, steps to fix this:

1.Find out the Apache version you are using, you can find this by looking in Services (Control panel, Admin Tools, Services) and finding Apache in my case it was listed as Apache2.4

2.Close XAMPP.

3.Run cmd as admin.

4.execute 'sc delete "Apache2.4"' (put your version in place of mine and without the surrounding ' ', but with the " " around Apache).

5.execute 'sc delete "mySQL"', again remove the '' when you type it.

6.reopen XAMPP and try starting Apache

If you are having trouble with FileZill, Mercury, or Tomcat you could try it here too, but I have not tested that myself.

Hope this helps!

Solution 2:

I realized it was a port issue since I was running IIS and other web servers in my machine. But I was more interested to see a detailed error message with the port number in the UI.

Seems like it was not logged in the UI or log file (at least in my case), but in the Event viewer (Control panel -> View Event Logs). Under the Even viewer -> Windows Logs -> Application

I could see a permission error something like the below one:

An attempt was made to access a socket in a way forbidden by its access permissions. : AH00072: make_sock: could not bind to address 0.0.0.0:443

To fix this permission issue for SSL port, Please change the below line in httpd-ssl.conf (C:\xampp\apache\conf\extra)

 # When we also provide SSL we have to listen to the 
 standard HTTP port (see above) and to the HTTPS port

     Listen xxx

Replace XXX with any valid port number that is open in your machine

If you are having issues with Port 80, then change the httpd.conf file (C:\xampp\apache\conf)

# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
 Listen 127.0.0.1:8000

I have also summarized other solutions that I came across:

  1. Most often Skype blocks the Apache port. So terminate it and try again.
  2. Find the process id (PID) that is using the Blocked port ( netstat -ano) and kill the corresponding process in Windows Task Manager.