# Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port)

**Code:** `Xdebug could not connect` · **Category:** PHP · **Seen on:** PHP, Docker

Xdebug has no IDE listening where it was told to connect.

## Meaning

The debugger runs in PHP and connects *to* your IDE. With Docker or a remote host `localhost` is the container, not your laptop. Xdebug 3 uses port 9003.

## Common causes

- IDE not listening or wrong port (9003 vs 9000)
- `client_host` points to the container
- Firewall blocks the port
- Debug mode not triggered

## Quick fix

1. Set `xdebug.client_host=host.docker.internal` (Docker Desktop)
2. Use port 9003 in the IDE
3. Start listening before the request

## Detailed fix by platform

### php.ini

1. `xdebug.mode=debug`, `xdebug.start_with_request=yes`, `xdebug.client_host=host.docker.internal`, `xdebug.client_port=9003`

## How to diagnose

1. **Port** — IDE listening on 9003?
2. **Host** — Reachable from PHP?
3. **Mode** — debug enabled?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/php/php-xdebug-could-not-connect-debugging-client)
