简体   繁体   English

Xdebug: [Step Debug] 连接调试客户端超时,等待:200 ms。 试过:本地主机:9003

[英]Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003

My php.ini configuration:我的 php.ini 配置:

[XDebug]
zend_extension = "C:\xampp\php\ext\php_xdebug.dll"   
xdebug.mode = debug 
xdebug.remote_autostart = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/xampp/tmp"
xdebug.show_local_vars=0
xdebug.remote_host = 127.0.0.1
xdebug.remote_enable = 1
xdebug.remote_port = 9003
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1
xdebug.remote_autostart=1
xdebug.idekey=PHPSTORM
xdebug.remote_log="c:/xampp/tmp/xdebug.log"

My launch.json configuration:我的launch.json配置:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9003
        }
        

    ]
}

but i am still getting this error in error.log:但我仍然在error.log中收到此错误:

[php:notice] [pid 9388:tid 1840] [client ::1:63322] Xdebug: [Step Debug] Time-out connecting to debugging client, waited: 200 ms. Tried: localhost:9003 (through xdebug.client_host/xdebug.client_port) :-(, referer: http://localhost/online-store/admin/types/insert-types.php

First I used the port 9000 but it didn't work, then I tried changing the port in php.ini and launch.json to 9003 same as the port in error log but still nothing is happening and XDebug is not working and not stopping on breakpoints.首先我使用端口 9000 但它不起作用,然后我尝试更改 php.ini 中的端口并将 launch.json 更改为 9003 与错误日志中的端口相同,但仍然没有发生任何事情并且 XDebug 没有工作并且没有停止断点。

I also encouneter with such an error after updting my Xdebug library to 3+ version.在将我的 Xdebug 库更新到 3+ 版本后,我也遇到了这样的错误。

What i found out is that new setting xdebug.start_with_request = yes configures Xdebug to establish a connection on every request, which is unnecessary even for development environment.我发现新设置xdebug.start_with_request = yes将 Xdebug 配置为在每个请求上建立连接,即使对于开发环境也是如此。

Meanwhile the official doc offers to use xdebug.start_with_request = trigger in order to connect Xdebug only if the need for it was explicitly indicated.同时,官方文档提供使用xdebug.start_with_request = trigger以便仅在明确指出需要时连接 Xdebug。 In this case i can start step debugging process with passing an extra key via GET parameters, for example http://localhost/?XDEBUG_TRIGGER=1 , but this is inconvenient for me, all I want is press F5 within my VSCode to start debugging as I always did.在这种情况下,我可以通过 GET 参数传递一个额外的密钥来开始逐步调试过程,例如http://localhost/?XDEBUG_TRIGGER=1 ,但这对我来说很不方便,我只想在我的 VSCode 中按 F5 开始调试就像我一直做的那样。

So my solution is the following.所以我的解决方案如下。 I left start_with_request = yes and turned off most of Xdebug notifications by passing xdebug.log_level = 0 .我离开start_with_request = yes并通过传递xdebug.log_level = 0关闭了大多数 Xdebug 通知。 Then i override log_level within launch.json file to enable all warnings but only within debugging session.然后我在launch.json文件中覆盖log_level以启用所有警告,但仅在调试session中。

php.ini : php.ini

[XDebug]
zend_extension = php_xdebug-3.0.4-7.4-vc15-x86_64.dll
xdebug.mode = debug,develop
xdebug.discover_client_host = yes
xdebug.log_level = 0
xdebug.log = "%sprogdir%/userdata/temp/xdebug/log.txt"
xdebug.start_with_request = yes
xdebug.idekey = VSCODE

launch.json :发射.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9003,
            "env": {
                "XDEBUG_CONFIG": "log_level=7",
            }
        }
    ]
}

I encountered the same issue with PHP8.我在 PHP8 中遇到了同样的问题。 In my case, it was just the XDebug version suggested by their own wizard.就我而言,这只是他们自己的向导建议的 XDebug 版本。 I use this version and it works just fine.我使用这个版本,它工作得很好。 php_xdebug-3.0.0-8.0-vs16-x86_64 php_xdebug-3.0.0-8.0-vs16-x86_64

launch.json:发射.json:

       {
            "name": "Listen for Xdebug",  
            "type": "php",  
            "request": "launch",  
            "port": 9003,  
            "hostname": "localhost",  
            "pathMappings": {
                "/var/www/html": "${workspaceRoot}/www/"
            },
        },

change pathmappings according to your requirements and the most important is hostname.根据您的要求更改路径映射,最重要的是主机名。 after i added that, it worked在我添加之后,它起作用了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Xdebug 问题:连接到客户端超时(等待:200 毫秒)。 :-( - Xdebug Problem: Time-out connecting to client (waited: 200 ms). :-( Xdebug:[Step Debug] 无法连接到调试客户端。 试过:localhost:9003(通过 xdebug.client_host/xdebug.client_port 回退):-( - Xdebug: [Step Debug] Could not connect to debugging client. Tried: localhost:9003 (fallback through xdebug.client_host/xdebug.client_port) :-( PHP Xdebug超时连接到客户端(Docker,VSCode,Ubuntu) - PHP Xdebug Time-out connecting to client (Docker, VSCode, Ubuntu) 在 VSCode 中连接 Xdebug 超时 - Time-out connecting Xdebug in VSCode xdebug连接到客户端的超时。 :-(使用phpstorm 7.1.3 / vagrant / virtualbox / magento - xdebug Time-out connecting to client. :-( using phpstorm 7.1.3/vagrant/virtualbox/magento Xdebug: [Step Debug] 无法连接到调试客户端 - Xdebug: [Step Debug] Could not connect to debugging client Xdebug 无法连接到调试客户端。 试过:本地主机:9000 - Xdebug Could not connect to debugging client. Tried: localhost:9000 PHP Xdebug日志显示超时连接错误。 使用Atom IDE - PHP Xdebug log show time-out connection error. Using Atom IDE 具有超时条件的XMLHTTPRequest - XMLHTTPRequest with a time-out condition 超时直到重启 - Time-out until restart
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM