3

It causes obiously no problems, but I wonder, why my apache changes his ports like me changing my mind. ^^

When I start the control panel - and start the apache - it starts with the standard ports 80,443 but when I make some calls on localhost the ports change. At the moment it's 64,49616,49855.

Is that a critical or normal behaviour? ;o)

Petra
  • 565
  • 1
  • 7
  • 20
  • Are you actually connecting to it at those ports? I.e. in your browser, going to http://localhost:49616 ? – Jay Dansand Apr 19 '13 at 14:35
  • No - not manually. But I've noticed, that the ports changed, when I call my actual project on Codeigniter. Does Codeigniter perhaps make these strange calls? – Petra Apr 19 '13 at 15:08
  • Ultimately, where are you seeing these ports? In the location bar of your browser? – Jay Dansand Apr 19 '13 at 15:17
  • I'm not setting any ports.. just calling php pages on localhost. And I haven't seen any port settings in there. – Petra Apr 20 '13 at 08:06
  • Where are you seeing (not setting) these ports? Where do you see "64,49616,49855"? In some kind of control panel, or in your browser while connecting? – Jay Dansand Apr 22 '13 at 13:09
  • Solution : http://stackoverflow.com/questions/11294812/how-to-change-xampp-apache-server-port/21914920#21914920 – Antoine Subit Sep 02 '16 at 10:12

1 Answers1

4

Apache shouldn't change ports while it is running. When it starts, it attempts to bind to its configured ports (80 and 443 in this case). Often this can be a problem, especially in Linux/Mac environments where ports < 1024 are restricted (only root/admin processes can bind to these ports), which is why the default XAMPP Apache ports are often 8080 and 8443.

Note that whenever a browser connects to a given remote host:port (even if that host is 127.0.0.1 a.k.a. localhost), it has to create a local port for the TCP connection, which is (in general) randomly chosen from the user-space set (the range 1024-65535). If you simply "netstat -n" your connections you'll find something like local 127.0.0.1:45678 connecting to remote 127.0.0.1:80 (if 45678 was the randomly-assigned local port). Note that the local port changes on every connection (every page refresh, unless KeepAlive is on), and shouldn't matter. Note also that the destination of the connection is called "remote" even if it's the localhost/127.0.0.1 loopback address.

Jay Dansand
  • 789
  • 1
  • 9
  • 13