[php] Apache is not running from XAMPP Control Panel ( Error: Apache shutdown unexpectedly. This may be due to a blocked port)

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

This question is related to php apache server xampp port

The answer is


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.


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]


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:

1) Under C:\xampp\apache\conf\httpd.conf , search for Listen 80 and change to Listen 81

2) Under C:\xampp\apache\conf\extra\httpd-ssl.conf, search for Listen 443 and change to Listen 444


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)


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/

For me it was because of vmware (services-it has about 2 or 3 different services),stop it and every thing works fine


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


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.


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


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.


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


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. 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

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.


Salam,

You don't need to change port no.

only go to task manager & end task any other programs that are running.

and then can you START APACHE.......

Sincerely,


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.


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.


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!

enter image description here

In my case, I had just to stop the VMWare service which was running automatically.

enter image description here

The key is to read carefully the message given by XAMPP Panel when started.

Hope this help!


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


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.


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


Run these commands in terminal and everything will work fine:

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

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 :).


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.


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


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


Examples related to php

I am receiving warning in Facebook Application using PHP SDK Pass PDO prepared statement to variables Parse error: syntax error, unexpected [ Preg_match backtrack error Removing "http://" from a string How do I hide the PHP explode delimiter from submitted form results? Problems with installation of Google App Engine SDK for php in OS X Laravel 4 with Sentry 2 add user to a group on Registration php & mysql query not echoing in html with tags? How do I show a message in the foreach loop?

Examples related to apache

Enable PHP Apache2 Switch php versions on commandline ubuntu 16.04 Laravel: PDOException: could not find driver How to deploy a React App on Apache web server Apache POI error loading XSSFWorkbook class How to enable directory listing in apache web server Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details How to enable php7 module in apache? java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing while starting Apache server on my computer

Examples related to server

npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json' Golang read request body currently unable to handle this request HTTP ERROR 500 How do I solve the "server DNS address could not be found" error on Windows 10? Server http:/localhost:8080 requires a user name and a password. The server says: XDB What does "app.run(host='0.0.0.0') " mean in Flask How to configure port for a Spring Boot application Apache2: 'AH01630: client denied by server configuration' Apache is not running from XAMPP Control Panel ( Error: Apache shutdown unexpectedly. This may be due to a blocked port) Express.js - app.listen vs server.listen

Examples related to xampp

Xampp localhost/dashboard phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO) Is there way to use two PHP versions in XAMPP? Where to find htdocs in XAMPP Mac phpMyAdmin access denied for user 'root'@'localhost' (using password: NO) How to downgrade php from 7.1.1 to 5.6 in xampp 7.1.1? How to turn on/off MySQL strict mode in localhost (xampp)? mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it How to install mcrypt extension in xampp Fatal error: Uncaught Error: Call to undefined function mysql_connect()

Examples related to port

Docker - Bind for 0.0.0.0:4000 failed: port is already allocated How do I kill the process currently using a port on localhost in Windows? Node.js Port 3000 already in use but it actually isn't? Can't connect to Postgresql on port 5432 Spring Boot - How to get the running port Make docker use IPv4 for port binding How to change the default port of mysql from 3306 to 3360 Open firewall port on CentOS 7 Unable to launch the IIS Express Web server, Failed to register URL, Access is denied XAMPP Port 80 in use by "Unable to open process" with PID 4