You’re running XAMPP. You hit “Start” on Apache. And boom…“Apache shutdown unexpectedly.” Now what?
This post is for anyone stuck at that screen wondering why their local server just gave up. It’s not random. Apache crashes like this for a few common reasons, and you don’t need to guess your way through them.
I’ll walk you through five solid fixes: clearing up port conflicts, checking for missing stuff, fixing permission problems, disabling whatever’s blocking Apache, and making sure you’re not accidentally running two of the same thing.
I wrote this to save you time:
Key Takeaways
- This error means Apache couldn’t start, often due to port conflicts or config issues. It stops your local site from running.
- Change Apache’s default ports if another app is using them. Edit XAMPP’s config files to switch from ports
80
/443
to8080
/4433
. - Restart Apache after changes to apply fixes. Use the XAMPP control panel to stop and start Apache so new settings take effect.
What’s this error even about?
As you’ve surely found out already, given you’re reading this post, while XAMPP is a great tool for local development, it doesn’t always work perfectly.
In the case of the errror message we’re discussing today, this problem can be particularly frustrating.
The warning appears usually when you try to boot up XAMPP, but sometimes in other scenarios too. Moreover, that’s not always the only error message you’ll see. You could also receive some debugging information, such as text similar to the following:
Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method. Check the "/xampp/apache/logs/error.log" file and the Windows Event Viewer for more clues.
That’s a lot of information in one message. Fortunately, the root issue is typically simple. Below, we’ll go through a more complete list of all the frequent causes and how to fix each one.
1. Resolve port conflicts with other apps
The “Apache shutdown unexpectedly” error usually means that there’s another app that’s using the same port that XAMPP does by default.
A port is a network connection point used by a variety of apps. Each port only supports one app at a time. Therefore, if another app is blocking the port XAMPP typically connects to, it will prevent the platform from starting up.
In other words, you might have another app running that started using the same network port that the Apache server is configured to run on.
By default, Apache communicates over port 80
for HTTP or 443
for HTTPS. If another app is already occupying the port, as a result, Apache cannot bind to that port and shuts down.
This conflict might occur randomly if the other app runs in the background only occasionally. Common culprits include:
- Skype (is anyone still using that?) or TeamViewer: Older versions of Skype listen on ports 80 and 443 for incoming connections. TeamViewer also falls back to port 80/443 if its default port is unavailable.
- VMware Workstation: The VMware Host Agent service uses TCP ports 80 and 443 by default.
- Windows IIS (Internet Information Services): On Windows, the IIS web server or related services can occupy port 80. This often happens if IIS is enabled or if services like SQL Server Reporting Services are running.
- Built-in Apache on macOS: Some macOS versions have an Apache server that might run by default or be enabled using port 80/443. This will obviously conflict with XAMPP’s Apache if both are running.
There are two ways you can fix this:
Option (a): If any of the above listed apps ring a bell – meaning if you know you’re using them and your XAMPP problems do seem to coincide – then you probably have your culprit.
Try disabling the app whenever you want to work with XAMPP. See if the error stops to occur. If so, then you can either stop using the given app when working with XAMPP permanently, or you can try to reconfigure the other app to use a different port. There are guides on the web on how to do it with each one.
Option (b): If you cannot stop the other application (or want to avoid doing so), you can reconfigure XAMPP’s Apache to use different ports. This in many cases can be the better solution.
Here’s how to do it:
First, go ahead and launch the XAMPP dashboard. The server itself doesn’t have to be turned on. As long as you can access your dashboard, you should be able to resolve the error.
Once again, I encourage you to only change these three items. Not only will modifying unrelated lines not solve this error, but it could also cause another one. If you accidentally edit the wrong element, you can restore your own backup or find the default Apache file on Github.
This handles the main Apache configuration file, but there’s also another similar file for SSL connections. Here’s how to deal with that one:
(We’re only handling this step on Windows.)
Lastly, restart Apache so that the new configuration settings can take shape.
Remember that your local XAMPP server now runs on new ports: port 8080
instead of 80
for http connections, and 4433
instead of 443
for secure connections.
For example, to navigate to your http local site now, you’ll usually use: http://localhost:8080/
2. Install missing dependencies
In 90% of the cases, solution #1 from above will do the trick. The main causes of the XAMPP error – Apache shutdown unexpectedly is that some app was set on the same port as Apache.
However, in rare cases, you might need to explore more remedies. This is the first of those.
In short, Apache may shut down or fail to start if required system libraries are missing.
On Windows specifically, XAMPP’s Apache is compiled with Microsoft Visual C++, so if the proper Visual C++ Redistributable isn’t installed, Apache won’t run.
You can solve this as follows:
- Go to Microsoft’s website or search for “Visual C++ Redistributable.” Download the appropriate version for your system.
- XAMPP on Windows is 32-bit by default, so you likely need the x86 package (even if you have a 64-bit OS). The Microsoft Q&A forums also suggest downloading the VC++ 2019 redistributable to fix this error.
- Then, run the installer and complete the installation. Once done, restart your computer (this ensures any system changes take effect).
- After reboot, open XAMPP and start Apache again. If missing libraries were the issue, Apache should now start without errors.
On macOS, all the required libraries are usually there already.
3. Fix missing permissions
Even if you haven’t manually edited XAMPP’s install config, it’s possible that something (usually another app) changed a setting, or a WordPress plugin added an .htaccess
rule that Apache doesn’t understand. A syntax error in httpd.conf or any included config, or an unsupported directive in an .htaccess
file, can prevent Apache from running. In such cases, Apache might start then fail (“shutdown unexpectedly”) as it encounters the error.
Here’s how to fix that:
First, open the Apache error log to see if it recorded a specific error message before shutdown. The file is located at:
- On Windows:
C:\xampp\apache\logs\error.log
(usually) - On macOS:
/Applications/XAMPP/xamppfiles/var/log/error_log
(usually).
Look for any lines indicating “Syntax error” or module load failures around the time of the crash. For example, an error log might show a line and file where the config failed.
Next, depending on what you find:
- If the error log points to
httpd.conf
orhttpd-ssl.conf
, open that file and fix the typo or incorrect directive. For example, ensure all file paths are correct, modules referenced actually exist, and syntax is correct (semicolons, quotes, etc.). - If it points to an included config (like a file in
apache\conf\extra
), edit that. Common issues might be in custom vhost definitions or an SSL certificate path. - If it points to a
.htaccess
in your WordPress site, open that file. A standard WordPress.htaccess
should contain various rules (more on those here). Remove or correct any problematic lines. For instance, if a plugin added directives that require a certain Apache module. You can also temporarily rename the.htaccess
to see if Apache starts without it – if yes, the issue is in that file.
After fixing the config, try restarting Apache via XAMPP.
4. Disable firewall or antivirus
Make sure no system firewall is blocking Apache.
Usually a firewall would block traffic, not shut down Apache, but double-check that Apache is allowed.
Some antivirus software may also mistakenly identify Apache as a threat if it’s listening on a given port. Ensure Apache/XAMPP directories are whitelisted in your antivirus.
If your antivirus has a web shield, try disabling it temporarily to see if Apache stays running.
5. Don’t run multiple instances of Apache
Verify that you don’t have another Apache service running that conflicts with XAMPP’s Apache.
On Windows, check Services for any Apache or WAMP services and stop them.
On macOS, as mentioned earlier, ensure only one Apache (preferably XAMPP’s) is running at a time – since macOS might have its own Apache instance running for different purposes.
Conclusion
Having to troubleshoot an error when you’re in the middle of a local dev project is annoying and eats up valuable time! Apache errors in particular can be frustrating, especially since you can get the “Apache shutdown unexpectedly” message seemingly randomly out of nowhere.
Fortunately, by altering a few configuration files, you can quickly resolve this frustrating roadblock.
In this article, I covered five easy steps to resolve the XAMPP error “Apache shutdown unexpectedly.”
🤔 Finally, a slight nudge maybe…if you regularly have problems with XAMPP, there are lots of other local development tools that you can consider, chief of them being Local. It’s modern, easy to use, and much better for local WordPress development. Here’s how to use it.
Do you have any questions about resolving the “Apache shutdown unexpectedly” error? Let us know in the comments section below!
Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!