How to Disable IIS 7.5 Automatic Startup on Windows Server for XAMPP/Apache Compatibility


8 views

When running XAMPP alongside IIS 7.5/8.0 on Windows, you'll inevitably encounter port conflicts since both web servers default to port 80. Here's a deeper look at why this happens:

netstat -ano | findstr :80
# Typical output showing conflict:
# TCP    0.0.0.0:80            0.0.0.0:0              LISTENING       4
# TCP    [::]:80               [::]:0                 LISTENING       4

The most reliable solution is to disable the IIS service completely via Windows Services:

sc config W3SVC start= disabled
net stop W3SVC /y

Alternatively, using PowerShell:

Set-Service -Name W3SVC -StartupType Disabled
Stop-Service -Name W3SVC -Force

For GUI-oriented users:

  1. Open "Turn Windows features on or off"
  2. Navigate to: Internet Information Services → Web Management Tools → IIS Management Console
  3. Uncheck all components
  4. Reboot to apply changes

If you need IIS occasionally, change its default port:

# In %windir%\system32\inetsrv\config\applicationHost.config
<binding protocol="http" bindingInformation="*:8080:" />

Create a batch script to ensure proper startup order:

@echo off
net stop W3SVC
timeout /t 5
cd C:\xampp
apache_start.bat

Add this to Windows Task Scheduler with "Run with highest privileges" enabled.

After implementation, verify with:

sc query W3SVC | findstr STATE
# Should show: STATE              : 1  STOPPED

curl -I http://localhost
# Should show XAMPP/Apache headers

For granular control, modify the application pool auto-start:

<applicationPools>
    <add name="DefaultAppPool" autoStart="false" />
</applicationPools>

Many developers working with XAMPP stack on Windows face a common issue where IIS automatically starts at system boot, occupying port 80 and preventing Apache from starting. Here's how to permanently resolve this:

The most straightforward solution is to modify the Windows Service settings:

1. Press Win+R, type "services.msc" and hit Enter
2. Locate "World Wide Web Publishing Service"
3. Right-click → Properties
4. Change Startup type to "Disabled"
5. Click Stop (if running), then Apply/OK

For those who prefer CLI, run these commands in an elevated Command Prompt:

:: To stop immediately
net stop w3svc /y

:: To disable future startups
sc config w3svc start= disabled

If you occasionally need both servers, change either server's default port. For XAMPP (httpd.conf):

Listen 8080
ServerName localhost:8080

Or for IIS (via IIS Manager):

1. Select "Default Web Site" 
2. Bindings → Edit
3. Change port from 80 to 8081

After making changes, test your configuration:

:: Check running services
netstat -ano | findstr :80

:: Try starting Apache
httpd.exe -k start

For automated environment setup, create a Powershell script:

# disable_iis.ps1
Stop-Service -Name W3SVC -Force
Set-Service -Name W3SVC -StartupType Disabled
Start-Process -FilePath "C:\xampp\apache_start.bat"
  • Administrator privileges are required for all methods
  • Changing ports may require firewall adjustments
  • Remember to restart services after configuration changes