I was also able to get my container to connect to PhpStorm with the linked thread, however I’m having trouble getting another container (linked to the one that works) to pause at break-points. Sep 15, 2017. Back to the IP address making the web request, where PHPStorm is running. However, running Xdebug with 'Docker for Mac' (D4M) is hard.
Some one tried to setup these tools together? • PHPStorm 2016.3 • XDebug • Docker • MacOS I can't have my xdebug working:/ Here is my config: RUN php5enmod xdebug && echo 'xdebug.remote_enable=1' >> /etc/php5/apache2/conf.d/20-xdebug.ini && echo 'xdebug.idekey=PHPSTORM' >> /etc/php5/apache2/conf.d/20-xdebug.ini && echo 'xdebug.profiler_enable=0' >> /etc/php5/apache2/conf.d/20-xdebug.ini && echo 'xdebug.max_nesting_level=700' >> /etc/php5/apache2/conf.d/20-xdebug.ini && echo 'xdebug.remote_host=192.168.7.165' >> /etc/php5/apache2/conf.d/20-xdebug.ini EDIT: I'll try the answer. Is the IP retrieved by running ifconfig inside the docker instance you want to run xdebug on? Because the IP value there did not work for me. The only way I have been able to get xdebug to trigger on my setup (which is a windows host by the way) is to use the IP assigned to my docker virtual ethernet adapter (DockerNAT, use ipconfig to easily find IP). One unrelated question of mine though is why for some reason, xdebug always wants to attempt a connection despite having remote_autostart set to false. You have also to mention to install phpize by sudo apt-get install php-dev.
Here is my version of dockerfile: ubuntu 14 + php5 + apache2 + xdebug ` RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -yq install curl apache2 libapache2-mod-php5 php5-mysql php5-mcrypt php5-gd php5-xdebug php5-curl php-pear php5-memcache php-apc && rm -rf /var/lib/apt/lists/* RUN echo zend_extension='$(find / -name 'xdebug.so')' RUN echo -e 'zend_extension='$(find / -name 'xdebug.so')' nxdebug.remote_enable=1 nxdebug.max_nesting_level=500 nxdebug.remote_connect_back=1 nxdebug.remote_port=9000' >> /etc/php5/apache2/conf.d/xdebug.ini `. Worked like a charm!!!, I still don't understand why!!! • Step 1: Create IP alias, run on your machine, not on docker container sudo ifconfig en0 alias 10.254.254.254 255.255.255.0 • Step 2: Config xdebug.so as usually, depended on what is your server (Apache2, Nginx, etc.) and add xdebug.remote_log='/tmp/xdebug.log' to watch. • Step 3: xdebug.remote_host=10.254.254.254, I have tried with other IP (also change alias following my new IP) but it does not work.???
• Step 4: Config your PHPStorm • Servers: Mapping your source files on docker • DBGp proxy: IDE key = based on your configuration, Host = 10.254.254.254, port = based on your configuration • Step 5: Edit configurations => Add PHP remote debug and select server as Step 4 and IDE key same as Step 4 • Step 6: Click listening for PHP Debug Connections • Step 7: hold my beer!!! THE SOLUTION run yes| pecl install xdebug-2.5.5 instead of yes| pecl install xdebug. Support for PHP 5.6.x and under seems to have been removed in the latest release (2.6.0) and up.
Source: THE PROBLEM This does not seem to work anymore. I just ran a docker-compose build --no-cache on a dockerfile with a change that was unrelated to xdebug, and this happened. Step 5/25: RUN yes| pecl install xdebug ---> Running in f14a14dee07c WARNING: channel 'pecl.php.net' has updated its protocols, use 'pecl channel-update pecl.php.net' to update pecl/xdebug requires PHP (version >= 7.0.0), installed version is 5.6.32 No valid packages found install failed ERROR: Service 'web' failed to build: The command '/bin/sh -c yes| pecl install xdebug' returned a non-zero code: 1 I then removed my changes to the dockerfile and ran the build command again, same result. Tried running pecl channel-update pecl.php.net before pecl install xdebug and again, the same result. Tried looking for the error message on google, the only similar one is this.
For me the followings works on Docker for Mac: xdebug.remote_autostart=0 xdebug.remote_enable=1 xdebug.default_enable=0 xdebug.remote_host=docker.for.mac.host.internal xdebug.remote_port=9000 xdebug.remote_connect_back=0 xdebug.profiler_enable=0 xdebug.remote_log='/tmp/xdebug.log' The docker.for.mac.host.internal host prevent scratching the head regarding IP alias or no network at all on host side. The source comes from the docker documentation No needs for extra configuration or environment variable in docker compose. When I debug wordpress with this configuration everything seems to work but one thing. I got 2 requests in every debug request. First request is good one which stops php scripts in normal debug session ( web server is paused and waiting for script to die or continue ). Second request seems to do nothing with web server, but xdebug client is working on breakpoint.
Same happen to me @Kil0p did you manage to solve? Also, i have an issue debugging a plugin, since in my dev environment i just expose the plugin directory and hide inside the docker container the wordpress code, the issue happens when my debugger try to step into the actual implementation but since the code is not there it fails. I Don't know if i explain it clearly, if not let me know. The problem is usually that there is some bug in the networking setup for Docker for Mac / Docker for win that causes the container not to 'see' the host machine. The host.docker.internal DNS entry solves this issue for both systems, although we noticed that it does not exist for native Docker under unix. To make this work for PhpStorm, the xdebug.ini file should contain at least two entries: xdebug.remote_host=host.docker.internal xdebug.remote_connect_back=0 (that is, if you want a debugging session triggered from the browser).