g33rt
g33rt

Reputation: 51

Phpstorm Xdebug not working with ddev

I'm using DDEV for drupal8-development. I have the same project on win10pro and on ubuntu18.04. On win10 I can debug in Phpstorm, on ubuntu it fails. I've already spent hours searching.

In the .ddev folder of the projects I sure did set the "xdebug_enabled" parameter to true. On the version on ubuntu I created additional configuration so that I receive logs from Xdebug. When ssh into the webserver container and I inspect the xdebug log at /var/log/xdebug.log it shows something like:

I: connecting to configured address/port: host.docker.internal:9000
E: Time-out connecting to client(waited: 200ms). :-(

from within the container I can ping host.docker.internal, the IP of host.docker.internal resolves to 172.17.0.1

When I inspect the logs from phpstorm on ubuntu it shows: 2018-08-16 13:47:39,141 [2778275] DEBUG - il.connection.ServerConnection - Starting 'Xdebug Server' on port 9000

Nothing seems to solve the problem. I already did export my phpstorm-settings from win10(where debugging does work) and import them in phpstorm on ubuntu and it still fails.

in phpstorm I do not receive any popup showing "new incoming connection from xdebug" Xdebug did work in the past, but never when using ddev. In ddev it's using 2.6.0 and the xdebug part of phpinfo() shows on ubuntu and win10 the same output. xdebug installed xdebug settings

help much appreciated. Geert

Upvotes: 1

Views: 1569

Answers (1)

g33rt
g33rt

Reputation: 51

It wasn't a DDEV-problem, it was indeed the firewall causing the issue. I created a rule for ufw:

 sudo ufw allow in on docker0 from 172.17.0.0/24 to 172.17.0.1/32 port 9000 comment xdebug

and a rule for iptables:

sudo iptables -I INPUT -p tcp -m tcp --dport 9000 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 9000 -j ACCEPT
You also need to make sure the rule is loaded at boot.

@rfay ,thanks for the hint.

Upvotes: 4

Related Questions