2

When I using XAMPP or WAMP I getting the following issue:

XAMPP - Port 80 in use by "Unable to open process" with PID 4! 12

And it`s easy to solve it by changing the .ini file of Apache and tell him to use port 8080 (for example)...

But then I need always to specify in the URL the custom port:

http://localhost.myapp:8080

While without modifying the default Apache localhost port: When he is the original 80, I could just put:

http://localhost.myapp

So I guess port 80 is default not just for Apache but for something else. My question if there is other way to config default parameter of browser/windows-system/whatever, to tell him that the default localhost port is now 8080 (for example), so I can still use the shorter URL version...

Thanks,

Community
  • 1
  • 1
michael
  • 3,835
  • 14
  • 53
  • 90

2 Answers2

2

According to RFC2616, the default port for HTTP is 80, so browsers are designed to interpret a request without a defined port as a request to port 80. As far as I'm aware, there is no way to override this default (without some serious modification of the browser's code), either for a single host (such as localhost) or for all hosts.

Bottom line: If you want to use a port other than 80, that port must be defined in the request, as in 'localhost:8080/asset'.

That said, this command should show you which program is listening on port 80 in most linux distros (so you can figure out what's keeping Apache from being able to use port 80):

 sudo netstat -apn | grep :80

For instance, on my little test server, I get this output:

tcp        0      0 0.0.0.0:80            0.0.0.0:*             LISTEN      1491/apache2

Which tells me it's being used by Apache (PID 1491).

Netstat is a great tool, here's an article that gives a few additional examples of how to use this tool.

Community
  • 1
  • 1
NNLocke
  • 112
  • 1
  • 9
1

If netstat is reporting that PID 4 is using port 80 it normally means that IIS, its a web server too, or one of its associated tools is running.

Microsoft have a port sharing mechanism that they use so multiple bits of IIS etc can share port 80 but Apache does not make use of it.

Look at your system (Programs and Features) for any of the following, I am afraid its not a complete list but covers the most likely candidates.

  1. IIS
  2. Web Deploy 2.0 (Web Deployment Agent Service)
  3. MS Sql Server Reporting service.
  4. BranchCache ( Windows 8.1 )
  5. SQL Server VSS Writer

If you are not using any of these then uninstall them, in W8+ MS seem to think its a good idea to install IIS by default but if you are not using it you can uninstall it without any issues.

Alternatively, if you are using them, but not while you develop using Apache/MySQL/PHP, you should disable them temporarily from the services snapin.

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149