XAMPP Apache not starting on Windows

XAMPP Apache not starting on Windows

In a previous article, we’ve explored the issue of Apache being unable to start on macOS devices. In this article, we will be exploring the same thing, but for the Windows version of XAMPP.

What should you do if XAMPP’s Apache service does not run on your Windows machine? Read on to find out.

Update 6 April 2023: Added some new solutions to the article.

  1. The problem
  2. Possible causes and fixes
    1. Changing the default XAMPP Apache port
    2. Disabling the World Wide Publishing Service (W3PS)
    3. Re-installing XAMPP
  3. Troubleshooting using XAMPP logs
    1. Getting output from apache_start.bat
    2. Reading Apache logs
  4. Conclusion

1. The problem

If Apache is unable to start on your XAMPP Control Panel, you will likely see the following error shown below:

XAMPP Control Panel Apache Error
The error messages shown when Apache fails to start.

When you try to start Apache Web Server, the XAMPP Control Panel will attempt to do so, but end up failing abruptly, mentioning that “Apache shutdown unexpectedly” (like the red text shown in the photo above).

Below is a transcription of the error, with the shutdown message highlighted.

[Apache] Attempting to start Apache app...
[Apache] Status change detected: running
[Apache] Status change detected: stopped
[Apache] Error: Apache shutdown unexpectedly
[Apache] This may be due to a blocked port, missing dependencies,
[Apache] improper privileges, a crash, or a shutdown by another method.

2. Possible causes and fixes

If XAMPP’s Apache cannot start, it is very likely that your default HTTP port (80), is blocked or being used by another application. To fix that, you can explore the solutions below.

a. Changing the default XAMPP Apache port

To determine if port 80 being blocked is your actual problem, you can change the default port number for Apache and see if it fixes your issue.

To change XAMPP Apache’s port number, refer to the steps below:

  1. Click on the Config button next to the Apache Web server (refer to the image below), and select httpd.conf.
  2. In the file, search for Listen 80 and change it to Listen 8080.
  3. Once done, try starting Apache on XAMPP again. If the problem was due to a blocked port, Apache should now start with no problem.
The Config button in XAMPP Apache
Where the Config button is in the XAMPP Control Panel.

Article continues after the advertisement:


Note that if you are using any other port than 80 or 443, you will have to append the port number at the end of the URL to access the page(s) on XAMPP. For example, if Apache listens to port 8080, the URL you will have to access will be localhost:8080 instead of the default localhost.

Note that for pre-existing virtual hosts on your XAMPP Apache, you will also need to update them to listen to port 8080 instead of 80.

If XAMPP still fails to start after changing your port, that means that the problem is not caused by a blocked port. In this case, you will want to undo the changes made to httpd.conf, so that Apache is back to using Port 80.

b. Disabling the World Wide Web Publishing Service (W3PS)

If you are running a Windows server machine, you may have a process running called the World Wide Web Publishing Service (W3PS). The W3PS is a component of Windows’ Internet Information Services (IIS) — which is responsible for providing HTTP and HTTPS services on Windows machines — may be using port 80, thereby not allowing XAMPP Apache to connect to the same port.

Below, you can read instructions on how to either deactivate or stop the W3PS service, so that port 80 can be freed up for Apache’s use.

To deactivate the W3PS service (so that it doesn’t automatically start on your Windows device):

  1. Open the Control Panel.
  2. Select View by > Large Icons, so that all the icons in the Control Panel appear. Then, select Programs and Features.
  3. In the Programs and Features window, click on Turn Windows features on or off.
  4. In the newly-opened window, expand the Internet Information Service field, and uncheck the World Wide Web Services checkbox (see the image below).
  5. Once done, reboot your device, then try to start XAMPP Apache again. It should be able to run on port 80 now.
Programs and Features in Control Panel
To find Programs and Features, you first need to change the View by to Large icons in the Control Panel.
Where to find World Wide Web Services
Where to find World Wide Web Services.

To stop the W3PS service (for this current boot) on your Windows device:

  1. Open the Windows Service Manager by pressing Windows + R keys, and in the popped window, type in services.msc and press Enter.
  2. Search for the World Wide Publishing Service option under the Name column and open its properties by double-clicking on it.
The World Wide Web Publishing Service on the Service Manager.
The World Wide Web Publishing Service (W3PS) on the Service Manager.
  1. In the General tab, click Startup Type and switch it to manual. Now, you are able to turn on/off W3PS manually.
  2. Stop the service and click OK.
  3. Try to start the XAMPP Apache web server again.

c. Re-installing XAMPP

If neither of the 2 fixes above worked for you, then there is likely a misconfiguration in your XAMPP installation or Apache config files. In such a case, you have 2 options:

  1. Read the log files to find out what happened, or;
  2. Re-install XAMPP (here’s the official source)

In most cases, re-installation will be the easier option. If you can uninstall it through the Add or remove programs interface, that would be best. Otherwise, if you can’t find XAMPP on Add or remove programs, you will have to find the folder where XAMPP is and manually remove the folder (it is usually found in C:\xampp). Always uninstall through Add or remove programs (or the Control Panel) if you have the option.

If you can’t find where XAMPP is installed on your computer, you can also do a search for xampp-control.exe on your File Explorer. The folder that contains xampp-control.exe is where XAMPP was installed.


Article continues after the advertisement:


3. Troubleshooting using XAMPP logs

If you still have trouble starting Apache after trying the solutions above, then your issue is very specific to your machine. In such a case, you will have to consult Apache’s or XAMPP’s log files to pinpoint what the error is.

a. Getting output from apache_start.bat

Funnily enough, the XAMPP Control Panel doesn’t actually output the messages that Apache outputs. Hence, if Apache doesn’t start, you can actually try running the apache_start.bat file in your XAMPP install folder (for most of you, it should be in C:\xampp\apache_start.bat). This will try to start XAMPP’s Apache using the Command Prompt, and output messages that you might otherwise not see in the Control Panel.

b. Reading Apache logs

You can also read Apache’s logs (error.log is probably the most useful one) to see if it provides you with any insight. The logs can be accessed from XAMPP Control Panel, using the Log button beside the line for the Apache module.

These logs will not be as helpful as the output from apache_start.bat however, as these logs are usually filled up when Apache is running; but our problem here is that it can’t even start.

4. Conclusion

Having read the article and applied the described solutions, we hope you could manage to fix your problems. Of course, there can be many more problems that cause this, and many with different solutions for these problems. If you are facing one of them that is not described in the article, please leave us a comment so that we can add this to the article (and credit you). Hence, your comment will help us make this article more and more helpful to everyone.


Article continues after the advertisement:


There are 2 comments:

  1. Just want to document an additional issue I spotted while troubleshooting a problematic install of XAMPP today. The computer I troubleshooted had 2 copies of XAMPP installed: one through Apache Friends’ XAMPP, and another through Moodle. Because of that, the Apache Friends’ version of XAMPP was not working, as it kept loading Moodle’s XAMPP and website.

    To rectify this issue, we had to delete the Moodle folder and delete our present install of Apache Friends’ XAMPP, as the Moodle install also messed up Apache’s start up after the uninstall (it was not able to load the files found in C:\xampp\apache\modules).

  2. Thanks for providing such important information and saving our precious time. Keep uploading such blogs👌

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: You can use Markdown to format your comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.