Change Apache Server Port 80 in XAMPP

If you need to test some PHP script, template designs, plugins or even making minor changes on the code, it is always advisable to do it locally on your computer rather than doing it on your production site which could probably annoy some of your visitors if they encounter problems caused by the modification. In order to test it locally, you cannot just run the PHP script from Windows Explorer. You will need to install a local webserver, either IIS or Apache and probably MySQL for database support for some scripts such as WordPress that requires it. The easiest way to have a webserver, database and FTP running on your computer is by using XAMPP. Just download the portable version, extract it on your computer, run the control panel program (xampp-control.exe) from the XAMPP folder and click the Start button according to the services that you want to run.

Recently I encountered a problem in starting the Apache server from XAMPP. Whenever I click on the Start button for Apache, the log window shows Apache start [Port 80] but the program does not show that Apache is running. I tried to access the localhost address from my web browser and it reports that the link appears to be broken. I was able to start the MySQL service without problems.

Apache Started Port 80

The first thing that came to my mind was port 80 is being used by another program because different services cannot share the same port number. I ran the netstat command and found that Skype was using both port 80 and 443. Fortunately there is a way to disable Skype from using port 80 and 443 by clicking the Tools menubar, Options > Advanced > Connection and uncheck “Use port 80 and 443 as alternatives for incoming connections”. Once you’ve done that, Skype will no longer use the ports and Apache service can be started without problems.

Use port 80 and 443 as alternatives for incoming connections

If you encounter a software that doesn’t allow you to change the port, you are only left with two options which is either to terminate the software that is using the port 80 or change Apache server port 80 to a different port so that it doesn’t conflict with the other software. Changing Apache server port 80 in XAMPP to a different port is quite easy but there are some rules to follow or else it won’t work. Open the httpd.conf file from \xampp\apache\conf\ with your favorite text editor and locate the line that displays Listen 80. If you want to change the Apache server port 80 to 800, update the line to Listen 800 and save the httpd.conf file.

Change Apache Server Port 80

When you click the Start button for Apache in XAMPP Control Panel Application, the log window will still show that Apache is started in port 80 which is a known bug but in fact Apache is actually started in port 800. You can run the netstat -a -b command to verify this. If you are uncomfortable seeing XAMPP displaying the wrong running port for Apache, you can change the display of the port number by creating a XAMPP.ini file in the root of XAMPP folder where xampp-control.exe file is located. Enter the following lines into XAMPP.ini file and save.

apache = 800

There is actually another bug in XAMPP whereby you will notice that the XAMPP Control Panel still won’t show that Apache is running even after changing to a different port. The trick is you need to first close the program that is using port 80, start the Apache service from XAMPP and then re-run the program that you previously closed. For some weird reason XAMPP still checks for port 80 even after you’ve configured Apache to listen to a different port from the httpd.conf file.

You might also like:

3 Comments - Write a Comment

  1. Endalkachew 2 months ago
  2. Conner 8 months ago
  3. Esther 1 year ago

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: Your comment is subject to approval. Read our Terms of Use. If you are seeking additional information on this article, please ask in our forum or contact us directly.