Knowledge

Address already in use (port already bound)

#Hosting

This error means another process is already listening on the port you tried to bind. Find what is using it and either stop that process or pick a different port.

Published by Mark van Eijk on June 23, 2026 · 1 minute read

  1. About the error
  2. Why do I see this error
  3. Solution
  4. Find what's using the port
  5. Stop it or kill it
  6. Or use a different port
  7. Crashed process, port still held

About the error

Starting a server fails with one of these:

bind() to 0.0.0.0:80 failed (98: Address already in use)   # nginx
Error: listen EADDRINUSE: address already in use :::3000    # Node
[ERROR] Can't start server: Bind on TCP/IP port: Address already in use  # MySQL

Only one process can listen on a given port at a time. The bind fails because something already holds it.

Why do I see this error

  • The service is already running (you started it twice).
  • A previous instance crashed but didn't release the port yet.
  • A different program is using that port (Apache holding 80 when you start nginx, another dev server on 3000).
  • A php artisan serve or Vite process from an earlier session is still alive.

Solution

Find what's using the port

ss (or lsof) shows the process holding the port. For port 80:

sudo ss -tlnp | grep ':80'
# or
sudo lsof -i :80

The output includes the PID and program name, exactly what's holding it.

Stop it or kill it

If it's a service you control, stop it properly:

sudo systemctl stop apache2     # e.g. Apache squatting on port 80

If it's a stray process that won't go away, kill it by PID:

kill <pid>
# if it ignores that:
kill -9 <pid>

To kill whatever is on a port in one step:

sudo fuser -k 80/tcp

Or use a different port

If you actually want both running, change the port of the one you're starting. For artisan serve:

php artisan serve --port=8001

Crashed process, port still held

A port can stay in TIME_WAIT briefly after a crash. Wait a few seconds and retry, or confirm with ss that nothing still owns it before restarting.

Subscribe to our newsletter

Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!

Related articles

How to get top processes with highest memory usage

This error means another process is already listening on the port you tried to bind. Find what is using it and either stop that process or pick a different port.

Read more →

How to get top processes with highest CPU usage

This error means another process is already listening on the port you tried to bind. Find what is using it and either stop that process or pick a different port.

Read more →