Docker and XDebug do not read VSCode breakpoints

I am using XDebug with PHP version 7.0. * Over the past 6 months on a MAC using remote debugging in a Docker container.

I ran an older version of docker that used VirtualBox for VM for dockers, everything worked fine.

I recently upgraded docker to version 17.03.1 and had nothing but problems with xDebug. I contacted the creator of vscode-php-debug through a problem in my repository, and he then told me to fix the problem with xdebug and / docker.

My problem is this:

XDebug is working and working on my container, the xdebug log shows that it connects to my IDE, but it just closes the connection, as if there were no breakpoints when I have breakpoints set in VSCode.

The problem I posted on vscode-php-debug can be found here

Which has a copy of my xDebug logs and VSCode debug logs ... Indicates that the connection is complete, but the breakpoints are not deleted.

I read several blogs that docker now needs a loopback ip created to connect to xdebug for work, which I also tried and failed.

It is very difficult for me to debug without a debugger after long use.

I tried many configurations, reinstalled, rebooted, rebuilt images / containers and didn’t even try the docker and xdebug irc channels on freenode without any success.

+4
source share
1 answer

EDIT 2018 plist. : https://gist.github.com/chadrien/c90927ec2d160ffea9c4#gistcomment-2398281 IP-.

[xdebug]
xdebug.remote_host = "docker.for.mac.host.internal"
xdebug.default_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_port = 9000
xdebug.idekey="PHPSTORM"

OLD CONFIG

mac, . .

, xdebug , php.ini.

[xdebug]
xdebug.remote_host=10.254.254.254
xdebug.remote_autostart=1
xdebug.idekey = PHPSTORM
xdebug.default_enable = 0
xdebug.remote_enable = 1
xdebug.remote_connect_back = 0
xdebug.profiler_enable = 1

, . sudo ifconfig en0 alias 10.254.254.254 255.255.255.0.

, plist . /Library/LaunchDaemons/com.docker.xdebugFix.plist. plist.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.docker.xdebugFix</string>
    <key>ProgramArguments</key>
    <array>
        <string>ifconfig</string>
        <string>en0</string>
        <string>alias</string>
        <string>10.254.254.254</string>
        <string>255.255.255.0</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

. Plist Mac.


PHPSTORM Config ( 2018)

PHP : php storm config 1

php storm config 2

, , , xdebug, , , .

+3

Source: https://habr.com/ru/post/1674621/


All Articles