I am trying to setup xdebug using laravel sail with latest version, on my Ubuntu 20.04.3 LTS desktop,
ie
php 8.1
laravel 9
with below mentioned details to .env file
SAIL_XDEBUG_MODE=develop,debug
SAIL_XDEBUG_CONFIG="client_host=172.23.0.1"
but when i run sail debug migrate, returns
Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: 172.23.0.1:9003 (through xdebug.client_host/xdebug.client_port)
When I tried finding IP, it change every time
docker inspect -f {{range.NetworkSettings.Networks}}{{.Gateway}}{{end}} <container-name>
return different IP like 172.25.0.1
I've been searching on this till I read about it being a firewall port issue here.
Then I remember the services.[laravel.test].ports on docker-compose.yml and tried to add 9003:9003 ports.
services:
laravel.test:
build:
context: ...
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: ...
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
- '9003:9003'
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With