Docker with Xdebug & VSCode on Ubuntu

preview_player
Показать описание
----------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------
We will see how to enable the debugging of containerized PHP applications inside of VSCode with the help of Xdebug. We will also install and configure the VSCODE extension.

Рекомендации по теме
Комментарии
Автор

Thank you so much. In Windows, it worked fine with but in linux (mine is Ubuntu 20.04), I changed host ip likes you pointed out and it worked well.

hienkpdl
Автор

Thank you so much!

My problem was the remote_connect_back, which was setted to 1.
I dont know why with this config was ruining my connection between the IDE and the Xdebug, but thank you for pointing that out.
This was making me crazy already.

If anyone with a similar problem gets here.
My setup is: Windows + Docker + WSL2
And my config:

xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=0
xdebug.remote_handler=dbgp
xdebug.remote_port=9000

andr
Автор

Thankyou very very much, I have been trying very hard since morning and you explained everything.

mayank_upadhyay_
Автор

Thanks Your tutorial,
I think you should use better than hard code IP address.

unixchan
Автор

I have found another way. I set these settings and it works: remote_enable=1 client_port=<your port, 9003 default> idekey=VSCODE discover_client_host=1, without client_host.

olegdmitrochenko
Автор

У меня заработала такая конфигурация Xdebug 3.2.1 в VScode и PHPstorm. Спасибо.

# Dockerfile

FROM php:8.1-apache

RUN pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& echo "\
xdebug.mode = debug \n\
xdebug.start_with_request = yes \n\
xdebug.client_host = host.docker.internal \n\
xdebug.client_port = 9003 \n\
xdebug.discover_client_host = true \n\
" >>

aleksandrsh
Автор

In my case even after allowing firewall the debugger doesn't interrupt code execution. Ubuntu 20.04

aeonsleo
Автор

i can;t set it up on mac. the container is up but there is nothing on the port

mikhailurmich