22

I have XAMPP installed on my machine. I am trying to run Apache from the XAMPP Control Panel.

I start the XAMPP Control Panel by right-clicking the shortcut and selecting "Run as administrator" (I am logged in on an account with Administrator privileges). The Control Panel starts up and everything appears to be in order (no error messages/warnings).

Xampp Control Panel After Startup

When I click the Start button next to Apache I get the following error message:

2:22:44 PM  [Apache]    Attempting to start Apache app...
2:22:45 PM  [Apache]    Status change detected: running
2:22:45 PM  [Apache]    Status change detected: stopped
2:22:45 PM  [Apache]    Error: Apache shutdown unexpectedly.
2:22:45 PM  [Apache]    This may be due to a blocked port, missing dependencies, 
2:22:45 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
2:22:45 PM  [Apache]    Check the "/xampp/apache/logs/error.log" file
2:22:45 PM  [Apache]    and the Windows Event Viewer for more clues

Xampp Control Panel Apache Error

Note that it's telling me Apache has shutdown unexpectedly and to check the error.log file and the Windows Event Viewer.

I checked the error.log file but it's empty:

Apache Error Log File Empty

I also checked for any events using Windows Event Viewer but the event viewer shows no events (under Application):

Windows Event Viewer No Application Events

I have checked for programs that might be blocking ports, etc. (like Skype, Visual SVN Server) and closed any programs that might be causing the issue.

Is there anything else I can do to find out what might be going on?

Thank you.

UPDATE

I figured out the problem by trying to run apache from a DOS command prompt. Running from the command prompt gave me the specific errors and the location in the httpd.conf file where those errors were. It turns out that my ServerRoot and DocumentRoot values were incorrect (pointing to wrong directories). I changed them to point to the correct directories and now I can start apache from the Control Panel.

Curious, why didn't I see the error messages about ServerRoot and DocumentRoot when launching from the Control Panel?

Jan Tacci
  • 3,131
  • 16
  • 63
  • 83
  • I was running Skype and got the error about port 80 so I exited Skype. – Jan Tacci Jan 13 '14 at 22:51
  • 3
    *UPDATE* I figured out the problem. My http.conf file had invalid entries. Specifically ServerRoot and DocumentRoot were pointing to the wrong/missing directories. – Jan Tacci Jan 13 '14 at 22:52
  • Glad you figured it out :) – Jochem Kuijpers Jan 13 '14 at 22:53
  • Thanks mate... you saved a lot of time :) cheeerrss – Umesh K. Jun 19 '14 at 10:22
  • @Jan Tacci - Thanks mate your invalid entries answer solved my issue. Actually, I had a virtual host created which points to file location on my external hard drive and while I was running xampp my external hard drive was not connected. Commented out that code and restarting xampp fixed the issue. – Vineet Sajwan Feb 15 '16 at 07:28
  • @JanTacci Thank you! I got the same problem, its about vhost.conf syntax error. you can see errors by running cmd and run C:\xampp\apache\bin\httpd.exe from there – PauAI Jul 23 '17 at 04:52
  • Thank you - all people who had this error before that I noticed was talking about the common culprit - blocked port 80. Your answer to run Apache in Command Prompt gave me a clear idea of what is wrong, and I could fix it properly. Finally, I can work! I was about to reinstall XAMPP from scratch... – Kobus Myburgh Oct 31 '17 at 18:09

7 Answers7

30

Just wanted to mention that I also used the command prompt technique.

MY PROBLEM: I had restarted Apache but was unable to get the program to start again.

Solution attempt 1: This did not work. I had no programs such as SKYPE hogging the ports, but I tried to adjust my port settings anyway.

Solution attempt 2: This did not work. Another solution I had read was to also allow public access in windows firewall or disable firewall. I attempted this.

Solution attempt 3: This did work Finally I stumbled upon this post. I opened gitbash (although default windows command prompt would work fine).

I typed "cd c:/xampp/apache/bin" I then typed "httpd"

This presented me with a syntax error and pointed me to a specific line in my "httpd-vhosts" file. I figured out what was wrong with that line, in my case a missing "#". Saved the file and then typed "httpd" again. This time the apache server started.

Hope this helps some people!

hekx
  • 301
  • 3
  • 3
  • This helped me get to what I needed to find. In my case I need to change my port (Listen) and ServerName in the httpd.config file. Thanks! – werdsackjon Jan 15 '16 at 20:40
  • 2
    Thanks a lot. Helped me. Was a problem with a syntax of Root directory. I did with a backslashes and it was wrong. **wrong**: `C:\Users\projects` **right**: `C:/Users/projects` – Vadim Apr 26 '16 at 07:11
  • Thank you sir. In addition my new "apache/extra" folder did not contain the correct files(previous installation) so I just copied them from my old installation and overwrite the new files in with the old ones. I upgraded and It worked. – megatr0n Aug 19 '17 at 03:13
  • Thank you, your Solution 3 was very helpful for me to debug my errors – Sunchock Jul 27 '20 at 08:48
  • Thanks very much. This make the error was displayed clearly in cmd. – le hien Feb 28 '23 at 08:09
1

In my case I had to install XAMPP on server running IIS and I have to have IIS running. So, in XAMPP, if you change port via main Config button > Service and Port Settings it will not do anything. Instead, simply click on Config Button for Apache and then Apache (httpd.conf). Change "listen 80" to "listen 8080" (no quotes) or whatever port number you wish - just make sure it's not currently used. I hope it helps someone.

user1060641
  • 179
  • 2
  • 2
  • 15
  • Thanks for the note on running Apache from command line... I had another error but running from the xampp console is quite unhelpful – r0m4n Mar 30 '14 at 01:25
0

This issue can happen because of three reasons 1. ServerRoot,DocumentRoot path not correct 2. Other applications already using ports in httpd.config or httpd-ssl.config. User NetStat button on XAMP control panel to check this conflict 3. Port set on XAMP control panel for httpd/httpd-ssl are not matchin with what is set in its respective config files

Please correct the above mismatches to rectify the issue

Praveenke
  • 31
  • 1
0

I faced the same problem and following is how i solved it.

  • Skype was using port 80, which is required by Apache server. therefore open skype and go Tools > Options > Advanced > Connection. Remove the tick "Use port 80 and 443 for additional incoming connections"

  • Open XAMPP Control panel and open "httpd-ssl.config" file and find the line "Listen 443" to another port (eg. "Listen 444").

Praboda
  • 520
  • 6
  • 12
0

Perhaps you have to configure the ports. In XAMPP control panel, at Apache line you can see an button with the name "Config" on it. Click on it and then in "Apache (httpd.conf)". It opens a file and you have to scroll it down to a line where there's something like:

#Listen 12.34.56.78:80

#Listen 80

Change the line "#Listen 80" to "#Listen 8088".

Maybe it will solve the problem.

  • You would want to remove the leading # else the line is still commented out and will be ignored, and Apache will just use the default 80 still. – Rup May 15 '18 at 21:56
0

My log files were not populated Windows event viewer did not log errors as raised from apache. But starting apache from cmd line gave the error message could not bind the port 80. I had skype running on port 80. Exiting skype didn't solve the issue. So I configured my port to 90 on httpd.conf file.


0

I had the same issues as many here, and was able to track it to apache/conf/extra/httpd-ssl.config. I had to comment out SSLCertificateFile "conf/ssl.crt/server.crt". However, this alone did not fix my issue, and running httpd from the CLI did not show any errors. I figured out I also had to set SSLEngine off in httpd-ssl.config.

Note: I did this on a local test server.

Royale
  • 1
  • 1