1

I'm new to ddev, but not new to Ansible, Vagrant, etc, or setting up Xdebug, and I can't for the life of me get step debugging to work with PhpStorm and ddev. I've tried changing ports and did all the steps in this thread How do I get xdebug/step-debugging working with ddev? to no avail. What am I missing?

Here are my settings:

APIVersion: v1.13.0
name: ee-dev-clean
type: php
docroot: ""
php_version: "7.3"
webserver_type: nginx-fpm
router_http_port: "80"
router_https_port: "443"
xdebug_enabled: true
additional_hostnames: []
additional_fqdns: []
nfs_mount_enabled: false
provider: default
use_dns_when_possible: true
timezone: ""

I'm setting my own 20-xdebug.ini file which is 100% accepted and showing correct values when I run phpinfo(). These are basically the same settings that do work in other Ansible/Vagrant based machines that I have running locally (all of them have been suspended while testing ddev).

[XDebug]
zend_extension=xdebug.so
; zend_extension="/usr/lib/php/20190902/xdebug.so"
xdebug.remote_host=host.docker.internal
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.show_exception_trace=0
; xdebug.remote_port=11011
xdebug.idekey=PHPSTORM
xdebug.remote_log="/var/log/xdebug.log"

The xdebug.log file has the following output after making a request and attempting to pick up a break point. I also have "stop at first line" enabled.

[1038] I: Remote address found, connecting to 172.18.0.1:9000.
[1037] I: Remote address found, connecting to 172.18.0.1:9000.
[1037] W: Creating socket for '172.18.0.1:9000', poll success, but error: Operation now in progress (29).
[1038] W: Creating socket for '172.18.0.1:9000', poll success, but error: Operation now in progress (29).
[1037] E: Could not connect to client. :-(
[1037] Log closed at 2020-02-19 19:56:05

[1038] E: Could not connect to client. :-(
[1038] Log closed at 2020-02-19 19:56:05

[1057] Log opened at 2020-02-19 19:56:50
[1057] I: Checking remote connect back address.
[1057] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[1057] I: Remote address found, connecting to 172.18.0.1:9000.
[1057] W: Creating socket for '172.18.0.1:9000', poll success, but error: Operation now in progress (29).
[1057] E: Could not connect to client. :-(
[1057] Log closed at 2020-02-19 19:56:50

[1037] Log opened at 2020-02-19 19:56:51
[1037] I: Checking remote connect back address.
[1037] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[1037] I: Remote address found, connecting to 172.18.0.1:9000.
[1038] Log opened at 2020-02-19 19:56:51
[1038] I: Checking remote connect back address.
[1038] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[1038] I: Remote address found, connecting to 172.18.0.1:9000.
[1037] W: Creating socket for '172.18.0.1:9000', poll success, but error: Operation now in progress (29).
[1038] W: Creating socket for '172.18.0.1:9000', poll success, but error: Operation now in progress (29).
[1037] E: Could not connect to client. :-(
[1037] Log closed at 2020-02-19 19:56:51

[1038] E: Could not connect to client. :-(
[1038] Log closed at 2020-02-19 19:56:51
Brian Litzinger
  • 5,409
  • 3
  • 23
  • 21
  • According to your log, the client (phpstorm) is not listening or not reachable. The other article you quote tells how to test this situation with telnet inside the container. This can be a result of different port set, firewall settings (turn off firewall until you solve this) or phpstorm just not hitting the listen button. And you don't need any extra config for phpstorm and xdebug, it works out of the box. Consider resetting phpstorm to defaults and starting over. Also, make sure you have recent phpstorm, as there was a 2018 phpstorm that stopped working with any xdebug. – rfay Feb 19 '20 at 21:15
  • PhpStorm is definitely listening and I have the latest version. Debugging works great with several other Vagrant boxes. Port is using default 9000. I tested the telnet inside the container and that seemed to work as well. Thanks for the input, I’ll give it another shot. I’m not sure what the 172 IP address is though. Is that the container IP? – Brian Litzinger Feb 20 '20 at 02:06
  • Also, it didn't work out of the box after setting up ddev. I did all the default options and enabled "break at first line" and PhpStorm never picked up, which is why I started modifying the xdebug.ini (which is based on the other Vagrant boxes that do work). – Brian Litzinger Feb 20 '20 at 02:14

1 Answers1

0

Ok, it was the port. I had to set it up to use port 11011 instead of 9000. Removed the 20-xdebug.ini entire override and added an xdebug-port.ini file with just the following:

[XDebug]
xdebug.remote_port=11011

Then changed the project settings in PhpStorm:

enter image description here

Also added the following server settings (though PhpStorm figured this out for me when it saw the incoming connection:

enter image description here

Brian Litzinger
  • 5,409
  • 3
  • 23
  • 21
  • 1
    Glad you got it working. You probably had php-fpm running on port 9000 on the host. – rfay Feb 21 '20 at 07:17