Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

xampp

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

like image 602
Karthik Avatar asked Mar 16 '15 04:03

Karthik


People also ask

Why is my Apache not starting in XAMPP?

Resolve Apache Port Conflicts. If Apache cannot start, you won't be able to access your XAMPP dashboard or any sites you have installed on the platform. A port conflict may be the underlying problem. By default, Apache connects over port 80.

Why my localhost is not working in XAMPP?

Run XAMPP (=> Apache) under an another port: Rename all ports with 80 to 8080 in your httpd. conf file. Your using Windows: Use notpad or editor with Ctrl+H to replace "80".


2 Answers

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!

like image 105
Alex Avatar answered Sep 28 '22 10:09

Alex


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.
like image 30
Karthik Avatar answered Sep 28 '22 11:09

Karthik