Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

martio's avatar

Xdebug doesn't work with Laravel Sail and PHP 8.1

Hi,

Xdebug doesn't work for me. Could not connect to debugging client.

  • Sail Version: 1.13.1
  • Laravel Version: 8.82.0
  • PHP Version: 8.1.1
  • OS: macOS 12.2

Steps To Reproduce:

  1. Add to the .env file:
SAIL_XDEBUG_MODE=develop,debug
  1. Rebuild application's containers

  2. Run an Artisan command with Xdebug

sail debug migrate

and...

Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client

Regards! :)

0 likes
2 replies
Sinnbeck's avatar

Are you sure your IDE listens on the correct port?

blueshift9's avatar

That SHOULD be all you need to set it up with Sail, I don't think you actually need to rebuild the containers, I THINK you just need to restart Sail.

I use the Xdebug Chrome helper and everything worked right away for me the first time I attempted to use Sail and php8.

Please or to participate in this conversation.