Updated November 2026: This guide has been rewritten and expanded. The steps below apply to current XAMPP versions on Windows.
If Apache refuses to start in XAMPP, the most common reason is simple: Apache wants to use port 80, but another program on your computer is already using it. XAMPP tells you this in its control panel log with a message like “Port 80 in use by …” followed by “Apache shutdown unexpectedly”. The fix is to move Apache to a free port, usually 8080. This guide shows two ways to change the XAMPP Apache server port, how to fix the matching SSL port, and what to check if Apache still will not start.
Why Apache fails to start on port 80
Only one program can listen on a port at a time. Port 80 is the standard port for web servers, so on a typical Windows PC several other services may grab it before XAMPP does, including:
- IIS and its World Wide Web Publishing Service, which ship with Windows
- VMware Workstation Server
- SQL Server Reporting Services
- Other local web servers or older communication tools that use port 80 for calls
You do not have to uninstall any of them. Changing Apache’s port in XAMPP takes about two minutes and does not affect your website files or databases in any way.
Method 1: Change the Apache port in httpd.conf
This is the classic method, editing Apache’s main configuration file.
- Open the XAMPP Control Panel and stop Apache if it is running.
- Click the Config button on the Apache row and choose Apache (httpd.conf). The file opens in a text editor.
- Find this line (use Ctrl+F and search for “Listen”):
Listen 80
Change it to:
Listen 8080
- Now search for “ServerName”. Find this line:
ServerName localhost:80
Change it to:
ServerName localhost:8080
- Save the file and close the editor.
- Back in the XAMPP Control Panel, click Start next to Apache. It should now show as running, with port 8080 listed beside it.
Both lines must be changed, and both must use the same new port. Changing only one of them is a common reason the fix appears not to work.
Method 2: Change the port from the control panel settings
Newer XAMPP versions can update the configuration files for you:
- In the XAMPP Control Panel, click the Config button at the top right.
- Click Service and Port Settings.
- Open the Apache tab.
- Change Main Port from 80 to 8080 and SSL Port from 443 to 4433.
- Save, close the settings, and start Apache.
Use whichever method you prefer — the result is the same. Method 2 has the advantage of changing the SSL port at the same time, which is covered next.
Do not forget the SSL port (443)
If you use https on your local sites, Apache also listens on port 443 for secure connections, and that port can conflict in the same way. If Apache still will not start after changing port 80, or your local https sites fail, update the SSL configuration too:
- In the XAMPP Control Panel, click Config on the Apache row and choose Apache (httpd-ssl.conf).
- Find
Listen 443and change it toListen 4433. - Find the virtual host line
<VirtualHost _default_:443>and change it to<VirtualHost _default_:4433>. - Find the
ServerNameline ending in:443and change the ending to:4433. - Save the file and restart Apache.
How to open your site after changing the port
Because Apache is no longer on the standard port, your browser needs the new port in the address. From now on, open your local sites like this:
- XAMPP dashboard:
http://localhost:8080/ - A site in your htdocs folder:
http://localhost:8080/your-site-folder/ - phpMyAdmin:
http://localhost:8080/phpmyadmin/
One extra note for WordPress users: if a local WordPress site keeps redirecting you back to plain localhost without the port, its stored site address still points to the old port. Update the Site Address in WordPress settings, or the siteurl and home values, to include :8080. If you are setting up WordPress locally and later plan a live site, see our guide on how much a website costs in Pakistan for what a live website typically involves.
Troubleshooting: Apache still won’t start
Read the red messages in the control panel
The XAMPP log names the exact program and process ID (PID) using your port, for example “Port 8080 in use by … with PID 1234”. That tells you precisely what to close or reconfigure.
Find what is using a port yourself
Open Command Prompt and run:
netstat -ano | findstr :80
The number in the last column is the PID of the program using the port. Find that PID in Task Manager (Details tab) to see which program it is.
Other checks
- Run the XAMPP Control Panel as administrator — some changes need the extra permission.
- Make sure the new port is not also taken. 8080 is the usual choice, but 8000 or 8888 work just as well; whichever you pick, use it consistently in the Listen and ServerName lines.
- Check that your antivirus or firewall is not blocking Apache, especially right after a XAMPP reinstall or upgrade.
- Confirm you saved the configuration files after editing — an unsaved Notepad window is a surprisingly common cause.
Frequently asked questions
Which port should I choose for Apache?
8080 is the standard alternative and the one used in this guide. Any free port works — just remember to add it to your browser address afterwards.
Do I need to change the MySQL port too?
No. This error is about Apache only. MySQL uses port 3306, which is a separate issue with separate fixes.
Will changing the port affect my files or databases?
No. Your htdocs files, WordPress installations and databases stay exactly as they are. You are only changing the door Apache listens on, not the rooms behind it.
Can I change the port back later?
Yes. If the program that was using port 80 is removed or stopped, repeat the same steps and set both lines back to 80 (and 443 in the SSL file), and your sites will work on plain localhost again.
Changing the Apache port is one of those fixes that looks intimidating the first time and takes two minutes every time after. With Apache running on 8080, your local development environment is ready again.

No comment