Apache is not running from XAMPP Control Panel ( Error: Apache shutdown unexpectedly. This may be due to a blocked port)
PhpApacheServerXamppPortPhp Problem Overview
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
Php Solutions
Solution 1 - Php
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
Solution 2 - Php
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
Solution 3 - Php
XAMPP Control Panel under Windows does not always reflect what is actually going on, unless you start it by "Run as administrator".
Solution 4 - Php
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.
Solution 5 - Php
Have you executed "setup_xampp.bat" script? It's inside XAMPP folder and it must be executed every time you change XAMPP folder.
Solution 6 - Php
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)
Solution 7 - Php
In my case the problem was that both port 80 and 443 were in use: Steps to use to fix it are :
- Open xampp and click on config button
- Now click on ( Appache )httpd.conf (Open in notepad or other editor)
- Now click ctrl + h.
- Find
80
and replace with8080
- Now save and now click on Appache(httpd-ssl.conf).
- Now find
443
and replace with4430
. - 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
Solution 8 - Php
If you are installed Skype, Please check this option.
Another case is Windows 10
Check this:
- Go to Start, type in services.msc
- Scroll down in the Services window to find the World Wide Web Publishing Service.
- Right-click on it, and select Stop or Disable it if you just want to use XAMPP only.
Solution 9 - Php
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.
Solution 10 - Php
I have installed VMWare Workstation. So, It was causing the error.
Services.msc and stopped the 'Workstation' Services.
This has solved my problems.
Thanks
Solution 11 - Php
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][2]][2]
Solution 12 - Php
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,
- logged out to skype for a while ,
- restarted apache from xampp control panel,
- checked on browser, whether it worked or not, by http://localhost/
- got it worked,
- signed in again to skype,
- 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
Solution 13 - Php
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
Solution 14 - Php
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
-
Open Command Prompt as Administrator
-
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.
Solution 15 - Php
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.
Solution 16 - Php
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.
Solution 17 - Php
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.
Solution 18 - Php
Using XAMPP for laravel development currently.
I have skype installed on my desktop, which blocks port 80 and 443 (both of which Apache uses)
This fix worked for me:
-
Under
C:\xampp\apache\conf\httpd.conf
, search forListen 80
and change toListen 81
-
Under
C:\xampp\apache\conf\extra\httpd-ssl.conf
, search forListen 443
and change toListen 444
Solution 19 - Php
Had the same problem and none of the above solutions worked. So, by reading carefully the logs, I found this message : > 10:55:42 [Apache] Port 443 in use by ""C:\Program Files (x86)\VMware\VMware Workstation\vmware-hostd.exe" -u "C:\ProgramData\VMware\hostd\config.xml"" with PID 1908!
In my case, I had just to stop the VMWare service which was running automatically.
The key is to read carefully the message given by XAMPP Panel when started.
Hope this help!
Solution 20 - Php
Run these commands in terminal and everything will work fine:
sudo /etc/init.d/apache2 stop
sudo /opt/lampp/lampp start
Solution 21 - Php
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 :).
Solution 22 - Php
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.
Solution 23 - Php
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.
Solution 24 - Php
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.
Solution 25 - Php
For me it was because of vmware (services-it has about 2 or 3 different services),stop it and every thing works fine
Solution 26 - Php
Use any method for which the server is working after that you can use this address to open the page on browser (if you've replaced the port 80 with 81 )
http://localhost:81/phpmyadmin/
Solution 27 - Php
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.
Solution 28 - Php
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.