1
votes

I have a problem debugging PHP with PhpStorm. I have container, and it is running Ubuntu 18.04.2 LTS and my host machine is macOS 10.14.5. I added configuration to PhpStorm, but breakpoint is not hit.

So, this is my xdebug.ini configuration:

zend_extension=xdebug.so
xdebug.max_nesting_level = 250
xdebug.remote_port = 9000
xdebug.idekey = "XDEBUG_ECLIPSE"
xdebug.remote_host = "192.168.1.144"
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1
xdebug.var_display_max_depth = -1

#  Enable the debugging on request
xdebug.remote_enable = on
xdebug.remote_autostart = off

# enable logging
xdebug.remote_log=/tmp/xdebug.log

When I run php -m -v, I can see under Zend Modules that Xdebug is enabled/installed. My php version is PHP 7.1.32.

192.168.1.144 is the IP of my host machine. I also checked that PhpStorm is configured to listen on port 9000

Xdebug settings

When I created new configuration, I set IDE key(session id) as XDEBUG_ECLIPSE, also, when I defined server under configuration, host is correct (dummy.test), port is set to 80, and Debugger is set to Xdebug.

I also ran command tail -f /tmp/xdebug.log, and when I refreshed the page, there wasn't any new entry in the log file.

Any idea what am I missing? I set up breakpoint to one index function of xy controller and is not hit, I also enabled break at first line in PHP script.

phpinfo

1
can you please add Dockerfile? - myxaxa
phpstorm is not detecting the ip - sh1hab
@myxaxa docker file is actually quite big (work project), if you could tell me what precisely would you like to see, I will be happy to show it. This is output of docker ps command: 9771a8a1bad2 core_dev:0.1.12 "docker/php-apache/f…" About an hour ago Up About an hour (healthy) 80/tcp, 4750/tcp core - golobitch
yes yes yes...it is working. apperently host.docker.internal resolved to different ip (192.168.65.2), when I added that entry to my host file, it started working. Please, post some summary as a answer and I will accept it. Thank you! - golobitch
@golobich probably it's pointing on docker bridge ip. but I never used Mac. so someone with better experience should help :) glad it helped you! - myxaxa

1 Answers

1
votes

so, with help of the topic owner it was found that for Mac host.docker.internal is set doc

as a hack-solution host ip was added to /etc/hosts inside docker container: host-ip host.docker.internal

probably there should be a better solution :)