Fixing a Blocked Port in XAMPP

You’re trying to use XAMPP to do PHP development. But when you start Apache, you get this error. The chances are that it’s due to a blocked port. In this video, I’ll show you how to fix that error by changing the port that Apache uses. Below the video, I provide text instructions.

How to fix a Blocked Port in XAMPP

The error you’re getting probably reads something like this:

[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.
[Apache] Press the Logs button to view error logs and check
[Apache] the Windows Event Viewer for more clues
[Apache] If you need more help, copy and post this
[Apache] entire log window on the forums

The chances are the error is due to a blocked port and that’s almost definitely port 80. One option would be to find the application that is using port 80 (probably Skype) and change it to use some other port. But you may not have control of that. In that case, you can change Apache to use a different port. Here’s how:

  1. In the XAMPP Control panel, click on Config:
    XAMPP Config
  2. Change the editor to something better than Notepad. I use TextPad:
    XAMPP Editor
  3. Click on Config by Apache and select httpd.conf:
    XAMPP Apache Config
  4. Find “Listen 80” and change it to “Listen 8080”.
  5. Find “ServerName localhost:80” and change it to “ServerName localhost:8080”.
  6. If you’re also running SSL, you’ll need to change httpd-ssl.conf:
    XAMPP Apache Config SSL
  7. Find “Listen 443” and change it to “Listen 4433”.
  8. Find “<VirtualHost _default_:443>” and change it to “<VirtualHost _default_:4443>”.
  9. Find “ServerName localhost:443”. It’s possible that this hasn’t been set up yet and it reads “ServerName www.example.com:443”. In any case, change it to “ServerName localhost:4443”.
  10. In the Control Panel, click on the main Config button again.
  11. Click on Service and Port Settings.
  12. Change the Main Port to 8080 and the SSL Port 4433.
  13. Close out of Configuration.
  14. Stop and Start Apache.
  15. Click the Admin button by Apache and it should open up the XAMPP home page in your browser.

I hope that helps!


Related Training: PHP

About Webucator

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Check out our complete course catalog.