Tomas Skovgaard
Tomas Skovgaard

Reputation: 4705

How to solve "Error: Apache shutdown unexpectedly"?

I've just re-installed XAMPP, and when I try to start my Apache server in the XAMPP Control Panel, I now get the following errors:

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

How do I solve this?

Upvotes: 467

Views: 2328650

Answers (30)

Davi Americo
Davi Americo

Reputation: 43

If you are on windows then go to task manager>details and kill all processes named as httpd.exe

enter image description here

Upvotes: 0

Covenant T. Junior
Covenant T. Junior

Reputation: 66

What I did was update to the latest XAMPP. I first uninstalled XAMPP, but backed up some of my projects before uninstalling it. Then I installed a new one afterwards.

Though I got the same error, what I did was download the latest Microsoft Visual C++ Redistributable and then restart my PC (perhaps this is what is needed to be done primarily).

Upvotes: 0

Bonestorm
Bonestorm

Reputation: 339

I had this error using XAMPP version 3.3.0

The solution was to install Visual C++ Redistributable because I didn't have it installed, after instalation, don't forget to restart your PC.

That's all.

Upvotes: 0

Shubham Kumar Gupta
Shubham Kumar Gupta

Reputation: 1147

Follow this for instant solution!

  1. This is coming either it doesn't have access to start a service to listen over PORT

Soln: Use Admin Access

  1. This is coming because already there is a port 80,443 is running on system

Soln: use netstat -ano | find "0.0.0.0:443" and then use taskkill /pid ENTER_PROCESS_ID /F to kill and restart Apache

  1. Search for background services that are running, and you don't need such as Mongo, node server, etc. Close them

  2. If nothing works open httpd.conf and httpd-ssl.conf files and replace 443 as 4431 and 80 as 8080

  3. Nothing works may be due to problem-related to files, so install XAMPP again in a location with no SPACE C:\XAMPP.

!!SOLVED!!

Upvotes: 1

Vikram
Vikram

Reputation: 7525

I have followed every other solution mentioned in the answer but it didn't worked. Simply I downloaded 64 bit version installable file and installed in my home directory. It all worked fine.

BTW, I don't have skype or anything and all the ports are open in my system when I checked netstat.

Upvotes: 0

CodeToLife
CodeToLife

Reputation: 4171

In my case it was much easier. I turned off the native windows firewall. Then re-loaded comp launched xampp and started apache again. Then turned the firewall on back.

I uninstalled and reinstalled xampp while having my antivirus disabled during installation after finishing, windows defender asked me for permission of allowing connection of apache which I allowed in private networks. So it was a firewall issue.

Upvotes: 1

Kingston Fortune
Kingston Fortune

Reputation: 957

Update 2023:

I found a quicker/faster way to resolve this without looking through the long list of services and ports, you can use this.

netstat -ano | findstr <Port Number>
taskkill /F /PID <Process Id>

make sure to change:

  • <Port Number> to the port you need either 8080 or 443.
  • <Process Id> to the PID of the service or app using the port.

Original 2019 post:

I have just encountered this error on my xampp v3.2.2 [win 10 pro x64],

I first tried to run the "net stop http" command in an admin cmd, but it didnt solve the issue, so I went ahead to try the "netstat -abno" command and i found out that the ssl port(443) was in use by vmware.

so my advice, don't just look for what's blocking port 80, also look for potential programs using port 443. because I really don't like changing my default port numbers to 8081 and 4433.

So this is how you can solve this issue...

firstly type the following command

net stop http

then try to start apache, if it still doesn't work. type out the following command

netstat -abno

and you'll definitely get that troublesome app that's using up your precious port.

copy the pid and then use the following command

taskkill /f /pid PID

where PID is the pid you copied.

Hopefully this helps someone.

Upvotes: 4

Ameer Chand
Ameer Chand

Reputation: 51

if the above mentioned / elaborated answer is not sufficient then try this command in xampp Shell as you can watch in attached image.

   **setup_xampp.batt**

enter image description here

enter image description here

just see the port id on which xampp is stared try to access with same port..

i.e http://localhost:4040/phpmyadmin/ 127.0.0.1:4040/phpmyadmin

Upvotes: 0

Herker
Herker

Reputation: 582

Try the following, none of the above solved it for me

  1. Select Run as administrator

enter image description here

  1. Then click on the big left box next to Apache

  2. Choose to uninstall Apache

enter image description here

Upvotes: 7

tinny77
tinny77

Reputation: 51

I had a similar error and changing port or running as administrator didn't work. I'm on Windows 10. I ran apache_start.bat from xampp directory and I got a more specific feedback that said there was an error on my https-vhosts.conf file, specifically an extra \ at the end of a document root. Removed it, it worked again.

Upvotes: 2

Abdullah Juma
Abdullah Juma

Reputation: 91

Step 1: In Apache go to Config then select Apache(httpd.conf)

In the notepad, find Listen 80 and add another 80 to change the port to become Listen 8080

Make sure to save before closing the notepad.

Step 2: In Apache go to Config the select Apache(httpd-ssl.conf)

In the notepad, find Listen 443 and add another 3 after 443 to change the port to become Listen 4433

Then search for VirtualHost default:443 and add another 3 to change the port to become VirtualHost default:4433

Make sure to save before closing the notepad.

(Note: There is a similar answer here but it did not work for me until I fond a video on YT)

Upvotes: 8

sorax
sorax

Reputation: 73

This worked for me and I wanted to share it

If you have already created ssl for xampp by folowing the steps in this article

open C:\xampp\apache\conf\extra\httpd-xampp.conf

check SSLCertificateFile "crt/site.test/server.crt"

if site.test in httpd-xampp.conf is different, then check C:\xampp\apache\crt\#YOUR_SITE_NAME_HERE\. change site.test in httpd-xampp.conf to #YOUR_SITE_NAME_HERE

Upvotes: 1

TheTechGuy
TheTechGuy

Reputation: 17384

In XAMPP Control Panel V3.2.1, click on "NetStat" button on top right. Make sure port 80 is not used by any other program. Then click on "Shell" Right below it. Issue this command in the shell prompt;

Apache_Start.bat

or type "ap" then tab the TAB key two times which will similarly generate the above command. You will actually see the exact error why Apache failed. It will be mostly likely virtual host configuration issue or may be something else. It will display the line number on which the error is occurring. Just fix that error. Note that in RootDocument a trailing \ can be a source of error as well. Remove any trailing "".

Upvotes: 185

Ajul Maharjan
Ajul Maharjan

Reputation: 44

After changing your port remember to change port in config. It will simply run by "http://localhost:8081/phpmyadmin/" instead of http://localhost/phpmyadmin/

xampp

Upvotes: 0

Kobina Ebo Yankson
Kobina Ebo Yankson

Reputation: 31

I tried all solutions but my problem persisted. It turns out after installing Visual Studio 2019, a lot of changes had occurred in my C++ Redistributables.

I actually run

test_php.bat

which showed me the error which was

C:\Windows\SYSTEM32\VCRUNTIME140.dll' 14.0 is not compatible with this PHP build linked with 14.28 in Unknown on line 0

I therefore proceeded to the:

Microsoft Visual Studio website --> Other Tools, Frameworks, and Redistributables --> Microsoft Visual C++ Redistributable for Visual Studio 2019

and downloaded. After installing the file and restarting my PC, problem solved. Apache now runs without errors

Upvotes: 0

Lightwaxx
Lightwaxx

Reputation: 765

Sometimes the issue is not a port issue but may be due to a misconfiguration that you did and Apache is not logging the error on the Event Viewer in Windows. To go around this, simply

cd C:\xampp\apache\bin

and then run

httpd.exe

Apache will then spit out the error for you e.g. as below

AH00526: Syntax error on line 2 of C:/xampp/apache/conf/httpd.conf: Invalid command 'This', perhaps misspelled or defined by a module not included in the server configuration

I hope that helps some poor soul :)

Upvotes: 7

Suave Bajaj
Suave Bajaj

Reputation: 109

Trick that works for me is,

Starting XAMPP as administrator

I tried changing ports using httpd.config and httpd-ssl.config. It ended my saving it in .txt file. Also used config on the right top. None worked

I am using VMworkstation.

Upvotes: 0

GeneCode
GeneCode

Reputation: 7588

Ok for my case it was really simple.

I set to a local IP address at my Ethernet port.

Then having this error. Turns out I did not connect the cable to it, so the IP does not resolve to the IP set in Apache.

Solution was to connect the cable to a switch or router. Then able to start Apache.

Upvotes: 0

DINA TAKLIT
DINA TAKLIT

Reputation: 8408

In my case, I got this problem coz Bitnami Wordpress was active.

  • Open the Bitanami App
  • Go to Manage Servers
  • Make Sure to stop MySql and Apache
  • Restart xampp and it will work.

Bitnami Manage Servers

Upvotes: 0

mfkocak
mfkocak

Reputation: 85

You can run apache_start.bat file from XAMPP directory for see details about your error details.

Upvotes: 4

Archana Moharana
Archana Moharana

Reputation: 35

You can go with the solutions mentioned above. This issue can be resolved by making changes in your "httpd.conf"(C:\xampp\apache\conf\httpd.conf) file and "httpd-ssl.conf"(C:\xampp\apache\conf\extra\httpd-ssl.conf) file. If still the issue persists you can check with your skype port.

But in my case this was different. I had to make changes in "server.crt"(C:\xampp\apache\conf\ssl.crt\server.crt) file.Try running your xammp apache from the command line in administration mode. "C:\xampp\apache\bin\httpd.exe" This will give you the errors -in which file and -which line. Likewise, I had an error in server.crt file which was blank. If you have xammp running in any other system, just copy the contents of this file(C:\xampp\apache\conf\ssl.crt\server.crt) and paste in your server.crt file and You are Done!

Thanks and Regards Archana

Upvotes: 0

katwekibs
katwekibs

Reputation: 1439

If all the answers above fail to work, Do this. comment out all the extensions in php.ini file.

  1. In xampp control panel, click on Apache config.
  2. click on php.ini
  3. In php ctrl + F (extension) to find all extensions in your php.ini
  4. Comment out each and every active extension by adding a ; at the start of each extension line. example

    ;;;extension=bz2

  5. i put 3 ;;; because i wanted to know ones i commented out so that when i come back to deburg which one had a problem, it was easy for me to see which ones i commented out.

  6. Make sure all extensions=whatever are commented out.

  7. Run your apache server.

  8. To pickup which extension was the problem, one by one un-comment your extensions while restarting your server until you catch the culprit.

Upvotes: 1

Loreto Gabawa Jr.
Loreto Gabawa Jr.

Reputation: 2056

It seems that no one has answered about executing xampp_start.exe.

I did all the previous answers but it did not fixed my issue. I found out that running xampp_start.exe will give you a detailed info about the issue.

This is what I see on my end:

xampp_start

As you can see I was having a path issue or xampp is pointing to non-existing folder.

Upvotes: 17

Patrick S
Patrick S

Reputation: 510

In my case port was already used by windows IIS service. You can check if port is being already used from cmd. Open cmd and run this command:

netstat -ano

If it is being used by IIS you can stop it by following command. Open cmd as administrator, then:

iisreset /stop

Now try running XAMPP, it should work.

Upvotes: 4

SreeniH
SreeniH

Reputation: 503

This worked for me...

If you are using windows...

Search 'cmd' in the windows search bar.

Enter this:C:\xampp\apache\bin\httpd.exe

Find which file and which line the error occurred.

For example, mine was in the file below on line 37.

httpd-multilang-errordoc.conf

Open the code and fix the error by either removing the line or fixing it.

Done! I should work now.

:)

Upvotes: 34

Vishist Varugeese
Vishist Varugeese

Reputation: 1580

If changing the port didn't solve the problem as suggested above, and if you had probably played around with the file directory structure (for instance, change the name of the folder after installation like I did) then you can try this,

  1. Open XAMPP Control Panel and click Apache's "Config"
  2. Choose the Apache (httpd.conf)
  3. In the editor that opened, press CTRL+H and find all instances of the old folder name and replace it with the new one.

For example, In my case, I had changed the main installation folder name of XAMPP from Xam to Xampp

So in the editor change this:

Define SRVROOT "G:/Xam/apache"
ServerRoot "G:/Xam/apache"
DocumentRoot "G:/Xam/htdocs"
<Directory "G:/Xam/htdocs">

To

Define SRVROOT "G:/Xampp/apache"
ServerRoot "G:/Xampp/apache"
DocumentRoot "G:/Xampps/htdocs"
<Directory "G:/Xampps/htdocs">

There are many other such instances in the editor, just find and replace each and every one of them.

Also do the same for, Apache (httpd-ssl.conf).

Upvotes: 0

zipzit
zipzit

Reputation: 4017

Same error. Turns out I had the wrong version of zend xdebug extension loaded. The xdebug wizard said to use the TS (Thread Safe) version (i.e. withOUT -NTS-), but apparently I downloaded the incorrect NonThread Safe version. Even though I had the path and file name accurate in the php.ini file, I was still getting the error. When I downloaded the different version, and updated php.ini again, everything worked well.

php_xdebug-2.7.0-7.3-vc15-nts-x86_64.dll gave me an error, but no error with php_xdebug-2.7.0-7.3-vc15-x86_64.dll

Upvotes: 1

Abuarif
Abuarif

Reputation: 4594

Open Skype.

Tools -> Options -> Advanced -> Connection.

Uncheck the "Use port 80 and 443 for alternatives for incoming connections" checkbox

Sign Out and Close all Skype windows. Try restarting your Apache.

Upvotes: 441

Arun Kumar
Arun Kumar

Reputation: 218

The solution is uninstall the xampp and reinstall it. it will be work

Upvotes: -1

Ceejay
Ceejay

Reputation: 7277

Even i had this issue and i resolved it, in my case it was different.

first i tried uninstalling the skype but that didn't work. but in my windows 10 desktop, i had the IIS(Internet Information Server) installed by default which was pointing to port 80.

All i did is i changed the port number to 8081 and just restarted XAMPP, and that worked for me.

however i was not using IIS.

here is the link to https://support.microsoft.com/en-in/help/149605/how-to-change-the-tcp-port-for-iis-services

Upvotes: 0

Related Questions