Complete, Concrete, Concise

Practical information without the bloat

How to Change the Apache Port in XAMPP

These instructions are for XAMPP 1.7.3 running on Windows XP.

They should be similar for other configuration combinations, but no guarantee is made.

These instructions should also work for an Apache Server install that is not part of a XAMPP install (specific details regarding file locations and restarting of the Apache Server will differ).

NOTE: XAMPP 1.7.4 and XAMPP 1.7.7 display misleading port information in the XAMPP Control Panel.

Regardless of which port you specify Apache to listen to, the XAMPP Control Panel will always display:

Apache started [Port 80]

This is WRONG!!!! This is a HARDCODED string in XAMPP 1.7.4 and 1.7.7. It does not reflect the actual port Apache is listening to.

Yet another reason why you should not be using XAMPP 1.7.4 or 1.7.7.

By default, Apache Server listens on port 80, but this can be changed.

Why Change the Port?

Perhaps certain ports are blocked by your network admin or ISP (although, I would not recommend running XAMPP as a publicly accessible server).

Perhaps port 80 is already being used by some other application (like IIS) and you don’t want to or are not allowed to shut it down or change it.

Apache Server is not starting and you are using XAMPP 1.7.4 (I recommend XAMPP 1.7.3). XAMPP 1.7.4 removed a useful port debugging tool, so changing the Apache Server port is one way of checking to see if you have a port conflict – change the port and if Apache Server starts working, then you know some other application is using port 80. You should try several ports, just in case you are lucky and manage to pick ports used by other applications. Some ports to try are 2375, 4173, 5107, 9260, 20010 – these ports, among others, are all listed as unassigned (but that doesn’t mean someone else isn’t using them).

How to Change the Port

Edit the httpd.conf file to change the port Apache listens on.

(1) Locate the file httpd.conf. This file should be found in C:\xampp\apache\conf (or whichever directory you installed XAMPP in – mine is on my D-drive because that is where I installed XAMPP).

(2) Open the file using a text editor or programmer’s editor (I use notepad++). DO NOT use a word processor (like Word) to open the file, it will badly mess it up.

(3a) Locate the line that says Listen 80. It is line #47 in the XAMPP 1.7.3 install.

(3b) Change the port number (80) to a different number (for this tutorial, I changed it to 1234).

(3c) Save the file.

(4) Restart the Apache Server to have the change take effect. Do this by clicking on the Stop button on the XAMPP control panel and then clicking on the Start button. (You could also just reboot the computer, but that is overkill).

Using the New Port

When you connect to the Apache Server, you will have to append the port number to the URL. Previously where you typed localhost, you will now have to type localhost:1234 (or whatever your new port number is):

Note: in Microsoft Internet Explorer 8 (IE8), it is necessary to prepend the prefix http:// before localhost: localhost:1234 will not work, it must be http://localhost:1234.

I did not observe this with Firefox 4.0 – entering localhost:1234 worked just fine (the browser was able to resolve the address as http://localhost:1234).

Second note: this is not a bug in IE8 – as a convenience, browsers automatically try to fixup URLs for you. Technically, you ARE required to type http:// before every URL you type in.



  • Adi Noor says:

    Can You please tell how to change localhost to any other thing like ip or name. like from http://localhost/index.html to mysite/index.html or ip/index.html.

    • admin says:

      Thanks for the question.

      You can find an article on how to do just that over here.

      • baljeet singh says:

        you can change it by changing or entering new ip followed by name or the url in the hosts file…….

        location ;:::: C:\Windows\System32\drivers\etc
        and then open hosts file in notepad or any text editor

        e.g. localhost baljeet_singh

        now save… and when now you type baljeet_singh it will show the same window as given by typing the localhost.

        • admin says:

          That will only work if the site is located in the root of /htdoc (XAMPP) or /www (AMPPS).

          If it is located in a subdirectory in either of those directories, then you will still need to add a path to the site name. For example:\joomla17 when what you really want to do is just enter

          Full instructions to do this can be found here.

  • Hey,

    Please, tell what is apache ant. Why it is different from apache. Is it a part of apache?

    • admin says:

      Strictly speaking, Apache is a community lead software development group. They work on over 100 different software projects. The best known being the Apache Server (which powers most of the Internet, there are others, but Apache Server is the most common).

      Apache Ant (I had to look it up) is a tool that is similar to make for other languages (like C or C++). It is developed in Java and primarily used for managing the build of Java projects. Ant uses XML to describe the build process whereas make uses plain text. Obviously, each has its own rules and formatting. works on projects in 19 different categories. You can have a look at them here.

  • Guru says:

    I installed XAMPP and configured the apache port to be 91. Now when I call phpmyain from XAMPP control panel, it is calling the URL http://localhost/phpmyadmin and not http://localhost:91/phpmyadmin.

    Please let me know how to correct this.

    • admin says:

      I just tried changing my Apache Server to listen on port 91 and it worked as expected – I needed to add :91 to my URL.

      Some things to check:

      (1) did you save the changes to httpd?

      (2) did you restart the Apache Server after saving the changes? See step 4.

      (3) do you have more than one version of XAMPP installed? If so, did you change the port in the correct version? If so, is the the correct Apache server running?

      One way to check if the Apache Server is listening on the correct port is to check out the article on Troubleshooting the Apacher Server not Starting and seeing which port(s) the Apache Server is using (the Apache Server has the process name httpd.exe).

      Which version of XAMPP are you running?

  • Geoff says:

    I identified the Web service that runs IE or Chrome as using port 80.
    So I did the steps on the Apache config file and set the port to 2375. When I start Apache it still gives a message “Apache started [Port 80], even although it has been changed.
    I rebooted the PC and the same message appears. The “running” status does not appear alongside the Apache service on the control panel (i.e. it never seems to start properly). The “running” status does appear alongside the MySql service.

    What am I doing wrong?

    • admin says:

      IE or Chrome should be using port 80 – this is the standard http port that web browsers use to connect to a http server. I would expect IE or Chrome to use this port to try and connect to the Apache server.

      What you don’t want is other http servers (like IIS) using this port at the same time that Apache is (byt the way, the Apache service is call httpd).

      From your description, it sound like the changes are not being picked up by the Apache server. There are 3 possible reasons:

      (1) You forgot to save the changes to the httpd.conf file. I think this is the most likely cause. If you open the file again and notice that the port is still 80, then this is the culprit.

      (2) You have more than 1 version of the Apache server installed (perhaps you have 2 or more XAMPP installations or maybe XAMPP and AMPPS) and you editted the wrong httpd.conf file.

      (3) You editted the wrong line in your httpd.conf file. There are 3 Listen lines in the XAMPP 1.7.3, 1.7.4, and 1.7.7:

      #Listen [::]:80
      Listen 80

      The first 2 lines (which begin with #Listen are commented out (the # is a comment symbol)), so they do nothing. If you changed the port number in them, then it won’t affect your port numbering.

      I also tried 2 other things, but couldn’t reproduce your results (except with the 3 scenarios mentioned above):

      (1) I wondered if a corrupted httpd.conf file could cause your problem – nope. The Apache server won’t start.

      (2) I wondered if maybe you had commented out the last Listen configuration – nope. The Apache server will start, but it won’t try listening on port 80 (or any other port).

      I tried those two tests because I thought Apache server might default to port 80 – from my tests, it doesn’t.

      • Geoff says:

        I checked that I had done the change correctly and that all seems to be ok.

        Maybe I should be running on port 80 anyway, but in that case I have the problem that I still get the message “Apache started [Port 80]” but it doesn’t actually start. The “running” status is not displayed and I can’t see the “localhost”. I am sure there isn’t another copy of xampp and when I looked at which services were listening to port 80 they were only the browsers, as I said. Do you have any idea what the problem could be?

        • admin says:

          It’s kind of tough from this end, but …

          The usual cause is some other internet server binding to the port first.

          Have you tried following the instructions in Troubleshooting the Apache Server not Starting?

          Is anything blocking port 80 (or port 443), then the Apache server will not start.

          Is your Apache server part of a XAMPP or AMPPS package? Which version of XAMPP or AMPPS are you running? Are you running on Windows or some other OS? Which version of Windows?

          Sometimes when you start the Apache service on Windows, it will pop up a warning (it happened to me earlier today when I was trying out your problem – but, now I can’t get it to do it) along the lines of “Do you want to allow this service?” (sorry, wording is from memory, so it is probably wrong). You should allow the service.

          • Mike says:

            Apache won’t let you start on a port that is already bound. 80, 443, 8080, 8000, whatever you set Apache to Listen on has to be a free port. You can see if the port is being used by analyzing the results from ‘netstat -ao’ (without quotes, from the command line)…

            XAMPP, even in the latest version, still displays port 80 in the XAMPP control panel when you start it up, no matter what you change the httpd.conf to Listen on. That’s what drew me here, have you guys figured this problem out yet? It doesn’t affect operations, apache is listening on the port it’s configured to, it’s just annoying that when starting up it reports it’s listening on port 80.

            • admin says:

              Yes, you can definitely use netstat -ao, but that isn’t quite as friendly as I think most readers would like.

              I prefer to recommend using cport to check which applications are bound to which ports. My tutorial on it is here.

              According to this comment on stackoverflow, the port value picked up by the XAMPP interface is read from a xampp.ini file. I the INI file is missing or the entry is not present, then the default display value is 80.

              Complain to the makers / bundlers of XAMPP. The XAMPP interface should be reading and displaying information from the apache config files, not blindly assuming certain default values.

              Better yet, it should just go back to not bothering to display the port information and restore the port check feature of 1.7.3.

              Thanks for your comment.

  • Naresh says:

    i try all the way you mention but still i have problem that apache stared [port 80] and i am not able to open localhost/phpmyadmin

    please tell me what i do? i have completly formate my PC ,i am using winXP service pack 3

    • admin says:

      Thanks for your comment.

      You’re not the first person to ask me this question and I have been puzzled by it because I have never been able to reproduce the problem (read my comments above to others) – until, I think, now.

      My best guess is that you are using either XAMPP 1.7.4 or XAMPP 1.7.7.

      Whenever you start the Apache service in 1.7.4 or 1.7.7, it always reports (in the XAMPP control panel): Apache started [Port 80]. This is WRONG!!!!! It always says Port 80 even if you have changed the port. Ignore what it says in the XAMPP control panel because it is not reliable.

      The best way to check which port your Apache server is running on is to use a port monitoring tool. See this article for instructions on installing and using one.

      After you change the port number you have to add it to localhost like this localhost:1234 (replace 1234 with whatever port number you changed it to).

      If you are using Internet Explorer, you will need to add http:// to the address.

  • Business Cards Manchester says:

    Excellent, you solved my problem, i ended up even installing Skype.

    Great Post


  • om says:

    For some reason even after changing the ports in the config file, apache wasn’t starting. I found I needed to change skype setting.
    I changed the skype setting but it didn’t work because my skype was still open even after changing setting. After I signed out and completely closed skype I was able to start Apache.

    • admin says:

      Skype had probably been configured to use ports 80 and 443, both of which are required for the Apache Server to run. Likely, you only changed port 80, but because port 443 was still being used by Skype, Apache still wouldn’t run.

      Troubleshooting port problem can be a pain. I’m glad you were able to resolve yours.

  • Mary says:

    I have installed Xampp on port 81 and it is running quite fine. However it reads something like: localhost:81/school

    I would want to replace that ’81’ with a name or do away with it altogether on the url. How do i do that? Thanks

    • admin says:

      Thaks for your comment.

      See this article.

      You would need to change the line <VirtualHost *:80> to <VirtualHost *:81> where the number (80 or 81) is the port number you are listening on – so if you changed your port to 1024, then you would use 1024.

  • Anto says:

    Hi there,

    I am having an issue starting up the Apache module through the XAMPP control panel; whenever I click on the button, nothing happens – I do not see the [Running] sign on the left side of it. Although when I start the MySql module, it runs fine.

    Have you got any ideas why it would do so?

    Thank you in advance

    • admin says:

      See this article on troubleshooting the Apache Server not starting.

      If Apache Server is not starting, it is likely a port conflict – some other application is using port 80 and / or port 443. If you have changed the ports usin this tutorial and it is not working, then it is likely that whatever port you changed it to is already being used by some other application.

  • Manoj says:

    I change As per Your Instructions But Still I am Getting error ie following
    java State 0 Service 0 State 0 Thread 0 Op 0 Port 8080
    Apachi Started [Port 80]

    Please Anybody can help me..

    That Java software i uninstalled.

    • admin says:

      Your error message seems to indicate some sort fo java issue. As far as I know (and I might be wrong), Apache Server does not depend on java.

      What I would suggest is (1) rename the folder XAMPP is installed in to something like ‘XAMPP-backup’; (2) install a new copy of XAMPP and try the changing the port number in the fresh install. I suspect you won’t have the problem. Then it is a question of finding out what is the difference between the two XAMPP installs.

      Please be aware that the XAMPP control panel will incorrectly display Apache as starting on port 80 – even if you’ve changed it.

  • randolph_07 says:

    Thanks a lot man.. I just install the XAMPP 1.7.3 and its working fine now.

  • Anny says:

    muchas gracias :)

  • john romania says:

    Hi guys, you can run xamp_start.exe to view errors !!!! Good luck !!!

    • admin says:

      Not so sure about that. With XAMPP 1.7.3 and running IIS to block the ports, I get the following:

      Starting "xampp"...
      "xampp" is not started.

      Not exactly informative.

      XAMPP 1.7.7 is a little more informative, but not much:


      XAMPP now starts as a console application.

      Instead of pressing Control-C in this console window, please use xampp_stop.exe
      to stop XAMPP, because it lets XAMPP end any current transactions and cleanup

      (OS 10013)An attempt was made to access a socket in a way forbidden by its access
      permissions. : make_sock: could not bind to address [::]:80
      (OS 10013)An attempt was made to access a socket in a way forbidden by its access
      permissions. : make_sock: could not bind to address
      no listening sockets available, shutting down
      Unable to open logs

      Still doesn’t tell you what the problem is. I still recommend installing a port checker as in this tutorial.

      Thanks for your comment.

  • Christiaan Mulder says:

    Changing the port on xmapp was all I needed (and I’m sure most other guys as well)… MANY THANKS!!!

  • GameDaddy says:

    Works fine now, Thanks!

    On Windows machines, to ensure multiple services aren’t listening on or using the same port, open a command prompt in admin mode and type;

    netstat -an

    using the an switch to see what is currently running.

  • shaheen says:

    thank u so much…it works….

  • pinkie says:

    Hey, thanks it helped me.

  • Valancio Fernandes says:

    ver : xampp1.7.3 works fine , I suppose the ver: 1.7.4 & 1.7.7 are not so stable . They still need to be engineered to perfection.

    • admin says:

      It should work the same for 1.7.4 and 1.7.7. The main differences are in the XAMPP panel and the default settings.

%d bloggers like this: