XAMPP is one of the best beneficial development tools. But, at some point, you will run into issues and start receiving alerts like ‘Apache Shutdown Unexpectedly‘. This error might emerge from anywhere, hence identifying the cause of this error and offering a solution can be quite confusing.
Luckily, there is a simple clarification for Apache’s sudden shutdown. By doing some simple alterations, you should be able to resolve the issue and get Apache up and running again. You just need to update some settings in the configuration files.
In this blog post, we will be discussing the basic cause of this Apache error in XAMPP and then show you the ways to fix this Apache error in both Windows OS and macOS. Let’s get started!
Introduction to the XAMPP ‘Error: Apache Shutdown Unexpectedly’
For those who don’t know about XAMPP, let us tell you XAMPP is a free and open source server stack that incorporates the Apache server and MariaDB database:
The XAMPP operates PHP and Perl scripts and is utilized to develop and test dynamic sites on local systems. This implies that if you are creating a website, you can install WordPress locally on your system. You can use XAMPP to test your website’s files offline before uploading them to a server like cheap Linux VPS hosting or cheap shared hosting.
If you are reading this article, we believe you already are somewhat familiar with XAMPP. But, what might be new for you is the ‘Apache Shutdown Unexpectedly‘ error that you are encountering.
This Apache error is usually caused due to a blocked port. In other words, this error is caused because another application installed on your system is using the same port as XAMPP. Moreover, you may observe that the error message signifies the issue may likewise be attributed to “missing dependencies, incorrect privileges, a crash, or a shutdown by another method.”
How to Fix the XAMPP ‘Error: Apache Shutdown Unexpectedly’ in Windows
If you work on a Windows device, you can follow the below steps to modify your default port settings in XAMPP.
Open the Configuration Settings from the XAMPP Control Panel
The first and the foremost step to launch XAMPP. You can do so by clicking on XAMPP icon. This will open the XAMPP control panel. Here, you can do the configuration setting for the server stack.
As our error is linked to Apache, we will concentrate on those settings. In the ‘Apache’ row of options, click on the Config button
This will be opening a drop-down menu of files. We are going to edit these files starting with httpd.conf.
Change the Default Port Settings of the httpd.conf File
From the file menu, click on Apache(httpd.conf). Once you open the file in your computer’s default text editor:
Inside this file, you can find three settings that you want to update. To begin with this, press Ctrl +F, then enter “80” in the search field:
This will show all the instances of the number 80 in the file. Search for ‘Port 80’ and change it to ‘Port 8080’. Once the port setting is changed, look for ‘ Listen 80’ and update it to ‘Listen 8080’.
Last but not least look for ‘servername localhost:80’. On finding it, change it to ‘servername localhost:8080’. Once you have made the changes, don’t forget to save the file and close it.
Update the Default Port Settings in the http-ssl.conf File
Next, let’s go to the second file. You can do this by returning to the XAMPP control panel, then choose Config beneath the Apache settings again. This time, you need to open the Apache (http-ssl.conf) file.
While the file opens in your text editor, press Ctrl + F, and later enter 443 in the search field. Locate “Listen 443” and modify it to “Listen 4433”.
Next, search the file for the next instance of “443”. It should be “<VirtualHost _default_:443>”. On finding it, you can move forward and modify it to “<VirtualHost _default_:4433>”. When you have accomplished it, don’t forget to save and close the file.
On updating the settings in both files, the last step is to prevent Apache. You can do this by clicking on the Stop button along the corresponding Apache row. After Apache has been halted, click the Start button to finish the process of restarting.
Now, Apache should run fine.
How to Fix the XAMPP ‘Error: Apache Shutdown Unexpectedly’ in macOS
Depending on what version of macOS you are running, you may likely have Apache installed on your system. the default apache application in mac will be using the same default port settings as the Apache server in XAMPP. Hence, this may be the reason for the ‘Apache Shutdown Unexpectedly’ error.
If you are using macOS, you can follow the following steps to update the default port settings.
Open the XAMPP Apache Configuration
To start fixing the ‘Apache Shutdown Unexpectedly’ error, ofcourse you will need to open the XAMPP Application Manager.
Next, pick the Manage Servers tab adjacent to the Welcome tab at the top:
On screen, you will find a list of choices. Pick the Apache Web Server, from the list and click on the Configure button.
Open the Conf File
From the Configure Apache Web Server box, choose the Open Conf File:
A warning box that state the file is for advanced users will pop up
You can click on Yes button to continue. This will open the httpd.conf file
Update the Port Settings
On opening the file in your text editor, the subsequent step is to update the port settings. You can do so by pressing Ctrl + F and then entering “80” in the search field. This will present instances of the number 80:
Look for these lines
#Listen 22.214.171.124:80 Listen 80 Once you do, go ahead and change them to the following: #Listen 126.96.36.199:8080 Listen 8080
Once you have done al the steps don’t forget to save and close the file. In the Configure Apache Web Server box, click on OK.
The last step is to halt and restart the Apache, you can do so by going to XAMPP Application Manager’s Manage Servers tab. Once Apache is stopped, click on Start to restart:
That’s it! Your port numbers will be updated and Apache should now run without any complications.
We hope, this blog post helped you understand how to fix the XAMPP Error ‘Apache Shutdown Unexpectedly‘
Additionally, you can check out the Managed WordPress Hosting plans that come with SSD storage and guarantee speed boost.