The Problem: Why Won't Apache Start?
When you press the Start button next to Apache in the XAMPP Control Panel, if the row turns green for a moment and then immediately goes back to red, and you see a message like the following in the log, you have a port conflict:
Apache shutdown unexpectedly.
This may be due to a blocked port...
Port 80 in use by ... with PID ...
The reason is straightforward: by default Apache wants to use port 80 for web traffic. If another program on your computer is already using this port, Apache cannot start. In some cases, port 443 used for SSL causes the same problem.
Which Programs Use Port 80?
The most common culprits are: Skype (older versions may use 80 and 443), IIS (Windows' own web server), VMware, various antivirus/security software, and sometimes the Windows service called World Wide Web Publishing Service. The solution is twofold: either you stop the program using the port, or you redirect Apache to a different port.
Solution 1: Find and Stop the Program Using the Port
Step 1: Which Program Is Using It?
Click the Netstat button on the right side of the XAMPP Control Panel. This shows which program is using port 80. Alternatively, you can open Command Prompt as administrator and run the following command:
netstat -ano | findstr :80
Using the PID (process ID) at the end of the line that appears, you can find the program in the "Details" tab of Task Manager.
Step 2: Stop the Program
If the problem is Skype: go to "Connection" in Skype settings, uncheck "Use port 80 and 443 for incoming connections", and restart Skype.
If the problem is IIS: you can disable "Internet Information Services" via Control Panel > Programs > Turn Windows features on or off, or you can stop the "World Wide Web Publishing Service" through services (services.msc).
Solution 2: Move Apache to a Different Port (Recommended Permanent Fix)
If you can't close the program using the port, moving Apache from 80 to port 8080 is the cleanest solution.
Step 1: Open the httpd.conf File
Click the Config button on the Apache row in the XAMPP Control Panel and select the httpd.conf file.
Step 2: Change the Port Number
Find the Listen 80 line in the file and change it to Listen 8080. Also change the ServerName localhost:80 line just below it to ServerName localhost:8080.
Listen 8080
ServerName localhost:8080
Step 3: Change the SSL Port (If Needed)
If port 443 is also conflicting, open the httpd-ssl.conf file from the Config menu on the Apache row and change the Listen 443 line to Listen 4433.
Step 4: Save and Restart
Save the files and Start Apache in XAMPP. You will now access the site at http://localhost:8080. If you have a WordPress site installed locally, you may need to update its address accordingly.
Solution 3: Run as Administrator
Sometimes the problem isn't the port but permissions. Close the XAMPP Control Panel, right-click its icon, and try reopening it with "Run as administrator". This can resolve permission-related startup issues.
If MySQL Won't Start Either
If you are experiencing the same issue with MySQL, port 3306 is usually conflicting (for example, you may have a separate MySQL installed on the computer) or the database files are corrupted. You can check for a port conflict with the netstat method above, and in case of file corruption you can restore from the backups in XAMPP's mysql/data folder.
Finding the Problem by Reading the Error Logs
When Apache won't start, instead of guessing, reading the logs XAMPP provides is the most accurate approach. In the XAMPP Control Panel, click the Logs button next to the Apache row and open the "Apache (error.log)" file. The last lines at the bottom of the file clearly state why startup failed. For port conflicts, you usually see phrases like "make_sock: could not bind to address" or "Address already in use". If there is a configuration error, the file and line where the error occurred are also stated here. Reading the log reveals the real source of the problem within minutes.
Beware of Configuration File Corruption
Sometimes the reason Apache won't start is not the port but a faulty edit made in httpd.conf or related configuration files. If Apache stopped starting after you made manual changes to the file, you most likely made a typo (a missing quote, a wrong path, an unclosed block). For this reason, always make a backup before changing such files; if a problem occurs you can easily revert to the previous state. The error.log file usually clearly states which line the error is on, so you can quickly find and fix the wrong edit.
Frequently Asked Questions (FAQ)
If I move Apache to port 8080, how do I access my sites?
After the port change, you access your sites at http://localhost:8080. Just adding :8080 to the end of the address is enough. If you have a WordPress site installed locally, you may need to update the site address (siteurl and home) according to the new port as well.
How do I find which program is using port 80?
You can use the Netstat button in the XAMPP Control Panel or run the netstat -ano | findstr :80 command in an administrator Command Prompt. With the PID number at the end of the resulting line, you find the program in the Details tab of Task Manager.
Why does Skype block Apache?
Some versions of Skype use ports 80 and 443 for incoming connections. This conflicts with Apache. You can solve the problem by unchecking this option in the Connection section of Skype settings and restarting Skype.
Conclusion
Apache failing to start in XAMPP is almost always caused by a port conflict. First, identify the program using the port by reading the error.log file and the netstat output; then either stop that program or move Apache to a free port such as 8080. With these steps you can solve the problem in a few minutes and continue developing from where you left off.