php7.0-fpm,使用VSCode IDE的nginx的xDebug配置不会在断点上停止

时间:2019-06-12 12:34:43

标签: nginx xdebug fpm

当我开始使用xdebug进行调试时,在没有在任何断点处停止的情况下,我就满意地收到此错误,并且在我未设置断点的警告中停止,并且当我单击local变量时,它开始一直加载并加载,直到必须重新启动vscode。

运行

Ubuntu linux 18.4
nginx

php -v
PHP 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:34:35) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-8+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.7.1, Copyright (c) 2002-2019, by Derick Rethans

xdebug无法在vscode上正常运行,它会在我没有放置断点的文件上中断,并且当我将鼠标悬停在变量上时也没有显示任何内容。

当我开始使用xdebug进行调试时,在没有在任何断点处停止的情况下,我就满意地收到此错误,并且在我未设置断点的警告中停止,并且当我单击local变量时,它开始一直加载并加载,直到必须重新启动vscode。

运行

Ubuntu linux 18.4
nginx

php -v
PHP 7.0.33-8+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:34:35) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-8+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.7.1, Copyright (c) 2002-2019, by Derick Rethans

我试图配置我的php.ini来更改远程设置,也尝试在xdebug.ini中进行配置,但是问题仍然存在,在vscode json文件中,我已将端口从9000更改为其他端口,但仍然没有结果。 / p>

我的php.ini

[Xdebug]
zend_extension="xdebug.so"
xdebug.remote_autorestart=1
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.remote_connect_back=1
xdebug.remote_log=/var/log/xdebug.log

和我的xdebug.ini

zend_extension="xdebug.so"

xdebug.log

[21636] Log opened at 2019-06-12 09:39:00
[21636] I: Checking remote connect back address.
[21636] I: Checking header 'HTTP_X_FORWARDED_FOR'.
[21636] I: Checking header 'REMOTE_ADDR'.
[21636] W: Remote address not found, connecting to configured address/port: localhost:9000. :-|
[21636] W: Creating socket for 'localhost:9000', poll success, but error: Operation now in progress (29).
[21636] E: Could not connect to client. :-(
[21636] Log closed at 2019-06-12 09:39:00

和Lunch.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": [

        {
            "type": "chrome",
            "request": "launch",
            "name": "Launch Chrome",
            "webRoot": "${workspaceFolder}\\web"
        },
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]

This is what us happening on the variables

我希望xdebug可以在断点处停止并显示局部变量,以便在调试Laravel和magento之类的大型框架时可以知道去哪儿。

谢谢。

1 个答案:

答案 0 :(得分:0)

尝试用下面的php.ini

中的设置替换Xdebug设置。
zend_extension="xdebug.so"
xdebug.remote_autorestart=1
xdebug.remote_autostart=1```
相关问题