IIS and XAMPP

Solve IIS and XAMPP Conflict without changing ports

I use IIS and XAMPP for in order to develop ASP.NET and PHP applications simultaneously. I have been using XAMPP since long time for PHP app development. I have moved to Windows Azure Development and ASP.NET MVC recently. In order to understand the exact request pipeline in ASP.NET and to learn other features of IIS, I installed it on my system which reserved port 80. After some days, I wanted to work on my blog theme. I started XAMPP and started Apache server. Apache server couldn’t start because port 80 was already blocked by IIS server.. This is what I error log said

6:49:49 PM [Apache] Status change detected: running
6:49:51 PM [Apache] Status change detected: stopped
6:49:51 PM [Apache] Error: Apache shutdown unexpectedly.
6:49:51 PM [Apache] This may be due to a blocked port, missing dependencies,
6:49:51 PM [Apache] improper privileges, a crash, or a shutdown by another method.
6:49:51 PM [Apache] Check the “/xampp/apache/logs/error.log” file
6:49:51 PM [Apache] and the Windows Event Viewer for more clues

Fix IIS and XAMPP Conflict – The solution

I tried playing with ports, it worked very well. Although changing port works like charm, I didn’t wanted to change port of either of the server. Instead I wanted something to do that will keep both the servers intact on same port. Since I don’t work on both the servers simultaneously, I found this idea better. Here’s what I have done –

  1. Close XAMPP.
  2. Start Internet Information Services (IIS) Manager
  3. On the right sidebar under Actions label, click STOP
  4. Close IIS Manager
  5. Start XAMPP and run the service again.
  6. This time, service will not stop itself since port is open for use.

What happened behind the scene?

Generally, when we run Apache service, it blocks port 80. In this scenario, port 80 is already blocked by IIS server. When we run XAMPP (Apache Server to be specific), it tries to block port 80 for use. Since IIS Server has already blocked it Apache doesn’t find it open. When we stop IIS server, the port becomes available again and Apache can successfully block it for it’s use. The solution is pretty straight forward but rookies can find this problem pretty hectic if they don’t know what is happening behind the scenes.

Limitation

Since we are blocking a port either by IIS Server or Apache, we are not letting the other use it. If you want to work on either any of the server at one time, this solution is a best workout. If you are planning to work on Apache (say PHP application) and IIS server (Say, ASP.NET application) you will have to change port of either one.

  • Anon

    Best thing is to keep both running on different ports e.g. IIS-80 and Apache-8080 kind of.

    • That’s what I have written in Limitation 🙂 Have given solution to people who wants to run both the servers without playing with ports 😉 Kinda lazy I am, Mayur! 😛

  • prakash

    thanks Rahul. I tried atleast 10 other solutions posted by others , from changing ports to commenting ourt lines in conf files, but none of them wroked. Your solution worked like a charm ad was the easiest too. Keep up the good work

    • Glad my post helped you. 🙂
      Keep visiting

  • zipzit

    Hmmm… one little issue. I just downloaded Windows Azure & WebMatrix (for a class on Node.js) Apparently it uses IIS. When I downloaded Azure it threw multiple programs onto my computer (Win8) The new programs I see are: Windows Azure Power Shell, Windows Azure Command, iSCSI initiator, Windows Memory Diagnostic, ODBC Data Sources, Windows PowerShell, Compute Emulator, Storage Emulator, and Microsoft WebMatrix. It’s confusing at this point. How do I start up IIS and then shut it down again with these tools?

    And by the way, thank you very much for posting up this issue in the first place.
    LB

    • Hey mate,

      I am personally using Windows Azure SDK for Azure development along with XAMPP (for WordPress).. I just turn off the IIS server and start XAMPP whenever I need to work on WordPress..

      It works, all the dependent services of IIS are turned off when you turn off IIS 🙂

      I hope that clarifies the issue!

      Regards,
      Rahul

  • Butler_Ricks

    Worked perfectly!

  • sarath chandra

    Thanks man. Made my day.

  • Tigej

    This doesn’t solve the port conflict because the port conflict is only a conflict if both are attempted to be run at the same time. Turning one of the services off so they’re not competing for port is stupid – you can just force IIS to run on port 81 or whatever if you like though