95

I have installed XAMPP (xampp-win32-1.8.2-0-VC9-installer.exe) on Windows 7 successfully. But unfortunately, the following error was found during running Apache from XAMPP Control Panel:

5:38:38 PM  [Apache]    Error: Apache shutdown unexpectedly.
5:38:38 PM  [Apache]    This may be due to a blocked port, missing dependencies, 
5:38:38 PM  [Apache]    improper privileges, a crash, or a shutdown by another method.
5:38:38 PM  [Apache]    Press the Logs button to view error logs and check
5:38:38 PM  [Apache]    the Windows Event Viewer for more clues
5:38:38 PM  [Apache]    If you need more help, copy and post this
5:38:38 PM  [Apache]    entire log window on the forums

Error on running Apache at XAMPP Controm Panel

3
  • 1
    Most probably, default port 80 is occupied by another application Jul 31, 2013 at 8:46
  • 1
    Note that the control panel doesn't necessarily give these details, it might just say "Apache startet [Port 80]" and not actually starting the server. Resolution is the same, though.
    – PeerBr
    Feb 5, 2014 at 15:32
  • Most of the case is because of Skype, Scroll down got see my anwser
    – vanduc1102
    Jul 14, 2016 at 12:13

26 Answers 26

102

There are many possible answers for this problem. The most common and most likely is that you're running another program which is blocking port 80 or 443. If you've installed Skype, then you've found your problem! Change apache's port settings to 81 and apache will work. There's a good tutorial on that To check this you can open up your command line by clicking the start menu, and typing 'cmd', and enter the command

    netstat -nab

this wil return a list of programs that will vaguely resemble this pattern

    [someprogram.exe]
    UDP     [fe80::numbers:numbers:numbers:numbers%numbers]:portnumber

You need to find a line (or lines) ending in :80 and terminate them in order to start apache. If there is no line ending in :80, there are more things you can do.

First, navigate to xampp's directory (default is c:\xampp) and double click apache_start.bat. This will open up a comand line and return more detailed errors about why apache can't run. Mostly, be looking for syntax errors that you could've created by editing your httpd.conf, or httpd-ssl.conf files. This is very easy to do if you've edited it and are a new user.

If still this fails, your last hope is to check the apache error log by clicking on the logs tab in apache's row in the xampp control panel and clicking error log.

If none of this works, don't give up! You got this!

Edit: If you change the port of apache, you will also have to go into httpd.conf (located in xampp/apache/conf) and near line 184, replace

ServerName localhost:80

with

ServerName localhost:81

It is also possible to specify port 81 in the url of your localhost, i.e.

localhost:81/my_project.php

11
  • 4
    I have changed port as 81 instead of 80. Apache is not started when I'm signed in at Skype. The error is 443 is occupied. So I'm doing well by running Apache before logged in at Skype. So sequence is: First Run Apache then log in to Skype Aug 1, 2013 at 4:38
  • 1
    When I start Apache it's running as: PID(s): 5316 & 5340 Port(s): 81, 443 Aug 1, 2013 at 4:41
  • 4
    I have modified line Listen 443 as Listen 444 on httpd-ssl.conf file. So Apache is running even during logging in to Skype. So Apache is runnin on port 81, 444. Nice... Thanks Timmay again. Aug 1, 2013 at 4:59
  • 2
    Try doing Run as Administrator during xampp control it worked for me, i dint have skype or any other application using port 80. Sep 18, 2014 at 4:23
  • 2
    apache_start.bat solved my problem. You should have mentioned it first :) Nov 20, 2016 at 16:42
45

1. Go in xampp/apache/conf/httpd.conf and open it.
In the httpd.conf file at line 176 Replace

ServerName localhost:80
with
ServerName localhost:81
It will work.

Or 2. Even if the above procedure doesn't work. Then in the same file (httpd.conf) at line 45 replace

   #Listen 0.0.0.0:80
   #Listen [::]:80
   Listen 80 

with

  #Listen 0.0.0.0:81
  #Listen [::]:81
  Listen 81
3
  • Also, I checked Apache and MySQL, which I shouldn't have done, because windows had them already. I unchecked them and all is well. Thank you.
    – timmyt123
    Dec 19, 2016 at 4:03
  • Works, but sucks also. You don't want to have to browse to localhost:81
    – Richard
    May 27, 2018 at 21:47
  • Thanks it works with me. Yes you are right, you have to change the port number of server and the listen. Thanks a lot for the help
    – HTML Man
    Aug 19, 2023 at 10:25
25

XAMPP Control Panel under Windows does not always reflect what is actually going on, unless you start it by "Run as administrator".

1
  • This was also my issue on Windows 10
    – Rémi
    Nov 21, 2015 at 20:40
22

Go in xampp/apache/conf/httpd.conf and open it. Then just chang 2 lines

Listen 80
to
Listen 81

And

ServerName localhost:80
to
ServerName localhost:81

Then start using admin privileges.

As I am working in a corporate environment where developers faces firewall issues, none of the other answers resolved my issue.

As the port is not used by Skype, but by some other internal applications, I followed the below steps to resolve the issue:

Step 1 - From the XAMPP Control Panel, under Apache, click the Config button, and select the Apache (httpd.conf).

Inside the httpd.conf file, somehow I found a line that says:

Listen 80 And change the 80 into any number / port you want. In my scenario I’m using port 8080.

Listen 8080 Still from the httpd.conf file,

You should also do this in the same process Still from the httpd-ssl.conf file, find another line that says

ServerName localhost:443 And change 443 to 4433.

ServerName localhost:4433 Remember to save the httpd.conf and httpd-ssl.conf files after performing some changes. Then restart the Apache service.

4
  • 2
    i too had the problem of running apache server.i changed the port number but its not working.plz help me out. May 5, 2015 at 14:55
  • 1
    after change port restart pc and try again or replace port 81 with 82 or 83 and so on
    – Behnam
    May 6, 2015 at 6:10
  • 1
    you also need to change the httpd-ssl.config file too for changing 443 default ssl port for apache.
    – autopilot
    Apr 7, 2019 at 4:00
  • ServerName doesn't need the port number
    – user27874
    Nov 20, 2020 at 14:18
16

Have you executed "setup_xampp.bat" script? It's inside XAMPP folder and it must be executed every time you change XAMPP folder.

1
  • this works for me as i am running windows server 2012 R2 so when i refreshed my windows my XAMPP installation was not in C drive after fresh installation i just ran setup_xampp.bat and it configured every thing successfully thanks cheers! Feb 19, 2019 at 7:24
15

In my case the problem was that both port 80 and 443 were in use: Steps to use to fix it are :

  1. Open xampp and click on config button
  2. Now click on ( Appache )httpd.conf (Open in notepad or other editor)
  3. Now click ctrl + h.
  4. Find 80 and replace with 8080
  5. Now save and now click on Appache(httpd-ssl.conf).
  6. Now find 443 and replace with 4430.
  7. Now your xampp must be working fine as both these code are never in use by other programs on your system.

Now your localhost will be available as localhost:8080

0
13

Accompanying Timmay's answer, You need to do two changes-

Listen 80 --> Listen 81 (near line 58)

ServerName localhost:80 --> ServerName localhost:81 (near line 218)

9

If you are installed Skype, Please check this option.

enter image description here

Another case is Windows 10

Check this:

  1. Go to Start, type in services.msc
  2. Scroll down in the Services window to find the World Wide Web Publishing Service.
  3. Right-click on it, and select Stop or Disable it if you just want to use XAMPP only.

enter image description here

8

I have installed VMWare Workstation. So, It was causing the error.

Services.msc and stopped the 'Workstation' Services.

This has solved my problems.

Thanks

1
  • I had the same issue, that this solution rescue me. Thanks Mar 25, 2023 at 19:19
6

Check if you have Skype installed on your machine.

Login and go to Tools - Options - Advanced - Connection and uncheck the box which says use port 80

--

Check if Apache service is already installed by firing up services.msc from run command prompt.

How to delete a service from command prompt? sc delete “serviceName”

Remember serviceName should be replaced by exact name of the Apache service as shown is services list.

Check if IIS is running and taking up port 80. If so, disable it.

--

Check if AVP (Kaspersky) is running and taking up port 80. If so add httpd.exe as an exception to allowed programs.

--

Hope it helps.

0
4

go to C:xampp\apache\conf\extra\httpd-ssl.conf
Find the line where it says Listen 443, change it to Listen 4330 and restart your computer

enter image description here

[![enter image description here][2]][2]

0
3

i have found that similar issue on my system, and that was from skype installed before xampp installed. i got similar error. for fixing the error i followed these,

  1. logged out to skype for a while ,
  2. restarted apache from xampp control panel,
  3. checked on browser, whether it worked or not, by http://localhost/
  4. got it worked,
  5. signed in again to skype,
  6. all working great, as simple as that

i wasn't need nothing to install or uninstall, and this worked for me in less then 1 minute.

cheers

1
  • Yes, it should work. The port which is being by Skype XAMPP also tries to use the same port. So, when you logout skype the problem wouldn't happen Jan 26, 2015 at 3:59
2

If You installed SQL Express or any .Net Server then you need to stop. open cmd in administrator mode and type this line ...

net stop Was

now start apache

2

The Best way to do so:

The other methods explained above will get you stuck at a lot of places Don't go for changing the port

2 Step Process

1) Open Command Prompt as Administrator

2) type net stop http (If it says it doesn't identify the keyword, then it is only because your Environmental Variable's PATH doesn't contain path to Program Files/System32 you can search on how to do it ) press Y at every place it asks you to, don't worry you are not stopping any important process just some process which took your port. And that process will again take over your port once you are not working.

0
1

If you face this issue directly after a complete new installation on Windows:

It seems like the setup program already starts the http.exe process and blocks the initial port 80 but does not reflect this state in the control panel.

To verify, just test for a running server in your browser. Type into your browser address bar:

localhost

If this displays the XAMPP dashboard, you're fine. Alternatively, check the Task Manager for a running 'Apache HTTP Server' (httpd.exe) process.

You could stop the apache process with the xampp_stop.exe in your xampp base folder. Then, the XAMPP control panel should work as expected.

1

There can be lots of methods to solve this problem, but here is simplest one:

GO to XAMPP-control and...

Run as administrator

That's all..

This is the Golden Point for any such Abnormality.

Concept behind the work

Actually all the services in Xampp need Ports dependency. What happens is, When there is no special powers given to xampp, it only look for some predefined ports to run those services. And, if in case, those ports are somehow already busy... eek! the service couldn't be started.

But if we give superpower to our Xampp-control (by running as administrator), it will somehow manage and for certainly on earth will run the services on the ports. And triumph! You made it.

Permanent tip for my dear Brother and Sisters

To do the efforts one and for all, follow these steps:

  • right-click on xampp-control.exe file and go to properties.
  • Go to Compatibility Tab.
  • In the settings below, choose the checkbox Run this program as an administrator.
  • Apply the changes. And you are done.

Now, every time you run the application, it will run with the Administrator status and You don't need to take care about the ports at all.

1

For my case, I didn't have htdocs folder in xampp folder. It seems that it requires htdocs folder to run so you can create an empty htdocs folder in the xampp folder.

1

Run these commands in terminal and everything will work fine:

sudo /etc/init.d/apache2 stop   
sudo /opt/lampp/lampp start
0

I have a solution. I had this problem and research a solution, but i did not succeed. So i downloaded a newer version of XAMPP and clicked on the option netstats within the program.
There he gave me a list of programs and the ports they used and so I looked and had no program using port 80, but apache beyond 80 also uses port 443... and there was a program called Pando Media Boster this door, I started the task manager and finished the process of pando Average boster. Hope it helped :).

0

I also faced the same problem. And I found an easy and fast solution.

The only thing you need to do is to run XAMPP server as administrator everytime.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

0

Probably you change configuration file in "httpd-ssl.conf"

<VirtualHost _default_:443>
DocumentRoot "D:/Server/xServer"
ServerName xyz.abc.com
SSLCertificateFile "conf/ssl.crt/xyz.crt"
SSLCertificateKeyFile "conf/ssl.key/sftaps.in.key"
</VirtualHost>

May be you change certificate name or something in Apache folder.

0

Even if you've configured Apache to listen on another port, you will still get this error if another program is using the default SSL port 443.

What you also need to edit is the http-ssl.conf file and alter the line Listen 443 and change the port number there.

0

just seeing this now since I have the same problem, but changing the port or any other answer didn't work for me.

Here's what was the problem - I've installed XAMPP to a custom location (eg. D:\Programming\XAMPP). Now, since the config files in xampp have simple locations (/xampp/mysql/data etc.) my services couldn't start.

So, I just had to rename all of those locations from /xampp/mysql/data to D:/Programming/XAMPP/mysql/data and now it's working.

0

for those of you who just manually activated windows defender Ransomware protection; it could be that your xampp folder or c:\ drive has been listed in the protected folder, and httpd.exe, php.exe was blocked from accessing it.

0
0

While it is most-likely the port blocking issue, you can always check if the settings of apache are correct:

  1. Open command prompt and navigate to your apache installation bin folder: cd C:/xampp/apache/bin

  2. Then run the following command to see if the syntax is OK: httpd.exe -t

0

It can also be due to the DocumentRoot parameter. In my case, port 80 was not a problem. The default DocumentRoot path and all virtual roots should actually exist and be correctly specified in the xampp\apache\conf\httpd.conf file in the DocumentRoot section (from line 252).

Depending on the installation location, it may look like this:

...
DocumentRoot "C:/xampp/htdocs"

<Directory "C:/xampp/htdocs">
    ...
</Directory>
...

Not the answer you're looking for? Browse other questions tagged or ask your own question.