Xdebug could not connect PHP Origin: Application & API OSI layer 7 · Application Last updated 2 Dec 2026

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

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

Exact message you may see Xdebug Could not connect to debugging clientStep Debug Could not connect to debugging client
Seen on: PHP Docker

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?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

Allowed memory size exhausted — PHP Fatal error: Allowed memory size of X bytes exhausted (PHP)Allowed memory size e…ArgumentCountError — Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed and exactly 2 expected (PHP)ArgumentCountErrorArray to string conversion — Warning: Array to string conversion (PHP)Array to string conve…Call to member function on null — Fatal error: Uncaught Error: Call to a member function x() on null (PHP)Call to member functi…Call to undefined function — PHP Fatal error: Uncaught Error: Call to undefined function (PHP)Call to undefined fun…Headers already sent — Warning: Cannot modify header information - headers already sent (PHP)Headers already sentOPcache stale code — PHP still runs old code after deploy (OPcache not reset) (PHP)OPcache stale codeXdebug co…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.