Change XAMPP and Apache port

It is common that, when faced with compatibility problems with Apache’s default port (port 80) in a Windows installation, you need to change the port that it uses in localhost. One of the programs that commonly uses this port is Skype.

With this tutorial you will learn to change the port of XAMPP, or what is the same, change apache server listening port. This tutorial applies to both XAMPP and WAMP distributions Apache server installations.

In addition, this tutorial is intended to be a quick and easy guide so that you can change apache port 80 in XAMPP to any other port you want (for example port 8080).

Content

  • How to change XAMPP port?
    • 1 Locate the configuration file
    • 2. Edit the Apache port in the configuration file
    • 3. Restart Apache and test the new port
  • Video change port XAMPP

How to change XAMPP port?

Change Apache server listening port it’s simple and fast. The process goes through:

  1. Open the configuration file, locate the lines where the port is indicated
  2. Modify all the lines where the port appears with the same free port (otherwise we will be once again in the same problem)
  3. Finally we just need to restart the server.

1 Locate the configuration file

As I have said, the Apache configuration file is the same for any XAMPP or WAMPP distribution. We have to locate the XAMPP or WAMP installation folder. Both in one installation and in another, the folders are in a default installation on the local disk C..

For WAMP we will have the folder Apache inside the folder bin in root directoryWithin this folder we will see the applications that we have installed in the distribution, usually Apache, MySQL and php. We access the folder Apache and we enter the one that we find that refers to the version of the server that we have installed. In the folder conf we will find the file we are looking for httpd.conf.

In the case of XAMPP we have the folder Apache directly at the rootwe access the folder conf and we found our searched file, httpd.conf.

2. Edit the Apache port in the configuration file

We open the configuration file httpd.conf with a text editorI highly recommend you install Notepad++ and open it with this editor, since it is a useful tool in our daily work as developers. You can also edit the file http.conf with any other text editor of your choice.

With Notepad++ we can search for the line that interests us with the shortcut ctrl+fthen we can write the default port of the configuration 80 or the one of our last modification. If you press search for next or you search by scrolling for the line that indicates the port, you will find two appearances of the port, in two different lines. The first usually indicates Listen 80 and the second ServerName localhost:80. You change the port to a free one, as a general rule I recommend you indicate 8080, 8085 or another moving in that range of values.

The first appearance:

The second occurrence should be like this:

save the file httpd.conf and close the editor. You already have configured apache listening port to a new one.

3. Restart Apache and test the new port

We go to our server in XAMPP or WAMPP and restart all services. In XAMPP, for example, in the configuration panel it will indicate next to the button START the listening port.

To test our new port and see our applications from now on (unless we have configured a host in the File host) we only have to write in the url of the browser:

localhost:8080/index.php

As you can see I have added : and the port just after indicating the url of the local server. From now on you should always indicate the port to test your applications locally.

Video change port XAMPP

If you prefer to see a video with a good explanation I recommend the following, explained step by step and very very clear. If you do not want to see the video you can continue reading the article.

Leave a Reply