Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xdebug不会在断点上停止-PHP centos Docker_Php_Docker_Visual Studio Code_Centos_Xdebug - Fatal编程技术网

Xdebug不会在断点上停止-PHP centos Docker

Xdebug不会在断点上停止-PHP centos Docker,php,docker,visual-studio-code,centos,xdebug,Php,Docker,Visual Studio Code,Centos,Xdebug,我正在尝试使用docker、X-debug2.7.2、centos和php7.3.7调试Laravel应用程序,但是不考虑断点。日志将更新为以下消息 [41] Log opened at 2019-10-02 21:09:33 [41] I: Connecting to configured address/port: docker.for.win.localhost:9000. [41] I: Connected to client. :-) [41] -> <init xmlns

我正在尝试使用docker、X-debug2.7.2、centos和php7.3.7调试Laravel应用程序,但是不考虑断点。日志将更新为以下消息

[41] Log opened at 2019-10-02 21:09:33
[41] I: Connecting to configured address/port: docker.for.win.localhost:9000.
[41] I: Connected to client. :-)
[41] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/public/index.php" language="PHP" xdebug:language_version="7.3.6" protocol_version="1.0" appid="41"><engine version="2.7.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]></copyright></init>
[41]
[41] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" status="stopping" reason="ok"></response>
[41]
[41] Log closed at 2019-10-02 21:09:34
Vscode配置

xdebug.remote_autostart = 1
xdebug.remote_connect_back = 0
xdebug.remote_enable = 1
xdebug.remote_host = docker.for.win.localhost
xdebug.remote_log = "/tmp/xdebug.log"
xdebug.remote_port = 9000
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "/var/www": "${workspaceRoot}"
              }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000,
            "pathMappings": {
                "/var/www": "${workspaceRoot}"
            }
        }
更新

经过多次尝试,我已经将x-debug配置下的远程_主机设置为本地机器的IP,并且成功了

对于那些认为别名host.docker.internal可以工作的人来说,它没有工作。因此,我所做的是为远程主机密钥设置一个虚构的名称,并在docker compose中将其配置为具有本地IP的额外主机


我不认为这是一个好的解决方案,因为每个使用这个配置文件的人都需要在本地修改它。所以我想知道你们是否有更好的解决方案。

这可能是一个有趣的问题,但你们是否使用浏览器插件与xdebug通信?与“调试”firefix或“Xdebug helper”chrome类似,这可能表示端口9000上正在侦听其他内容。您正在使用PHP-FPM吗?如果是这样,请将PHP-FPM端口更改为其他端口,或者更改为Xdebug端口。您的IDE有一个it端口设置:9000,两次,在php.ini中,您可以使用xdebug.remote_port=9001作为示例。如果您对php.ini或90-xdebug.ini进行了更改,请重新启动您的web服务器。

可能的重复情况与此不同。在创建此主题之前,我已经尝试了引用主题中提到的所有步骤。我不确定操作系统对这个问题的影响,但是,我之前使用的直接来自PHP docker hub存储库的图像工作正常,另一方面,使用centOS不会。我没有使用任何额外的插件。在发布这个问题之前,我已经尝试过了,但没有效果。日志表明docker和IDE之间的连接已经建立,但是,我不知道为什么IDE中没有突出显示断点。根据您的建议,它没有连接到客户端,Xdebug记录如下[57]W:正在为“docker.for.win.localhost:9001”创建套接字,轮询成功,但错误:操作正在进行29。[57]W:正在为“docker.for.win.localhost:9001”创建套接字,connect:无法分配请求的地址。[57]E:无法连接到客户端。:-```