Blocked port 80 is not letting you start Apache on XAMPP – Chill

If you’re running apache-tomcat, jetty, node js or any kind of web server in your computer and you’ve consumed the port 80 (default port for http) in any of these applications (or may be all), chances are high that you may end up on some bad day with an occupied port 80.

This in turn, doesn’t allow you to start XAMPP server (apache) which ends up saying “Failed to start server”-isque message. If changing your startup in msconfig/boot-config or restarting your system – has not helped you yet, then

Possible ’causes’ could be:

  • You forgot to terminate any server process correctly (and probably that also loads with system startup)
  • You might be running Skype (old issue) along side XAMPP.
  • You’ve been cursed (lol)

If you already know / can guess nicely / suspect about – which application could be occupying the port 80, then you can check for running processes and kill the process e.g. kill eclipse or node or any suspects from your shell / task manager / terminal.

$ ps -au deveedutta
  UID   PID TTY           TIME CMD
    0     1 ??         0:34.50 /sbin/launchd
    0    16 ??         0:03.76 /usr/sbin/syslogd
    0    17 ??         0:06.64 /usr/libexec/UserEventAgent (System)
$ ps -au deveedutta | grep apache


$ ps -a
$ ps -a | grep apache

That should work.

But things can be complicated sometimes e.g. you may not know which application could be occupying the port, and imagine if the port number is 5441(say), a fairly non-trivial one.

Let me introduce you to my favorite (works on linux/unix but for OSX it’s a bit different)

$ sudo netstat -lpn | grep :5441

# or
$ sudo netstat -lpn | grep apache

MAC users may Now first, let’s get the list of PIDs that could be owning the port.

Go to bash or any terminal you use. Type –

$ netstat -no

or, you can also try

$ netstat -ao

It’ll fetch you a list of network connections, both incoming and outgoing. Don’t get intimidated by the list. Just try finding the process that has under it’s Local Address.

Found it? Cool. Now, to free up the resource i.e port 80, we need to terminate the process owning it.
Try killing the pid using the kill signal

No success?

Well, in my case, I was running Tomcat and I closed it abruptly (clicked close button). So, the resources might not have released properly.

Go to the bin directory in Tomcat's folder and double click on "shutdown.bat"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s