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
- About the error
- Why do I see this error
- Solution
- Find what's using the port
- Stop it or kill it
- Or use a different port
- 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 serveor 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. For the focused walkthrough, see how to kill the process on a port.
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!