Xdebug v3.0.2 with PHP v8.0.0

我怕爱的太早我们不能终老 提交于 2021-02-10 14:44:58

问题


I just have migrated to php v8.0.0 with XAMPP v3.2.4. But Xdebug is not working. Execution is not stopping on breakpoints.

My installation instructions-

Download php_xdebug-3.0.2-8.0-vs16-x86_64.dll
Move the downloaded file to \xampp\php\ext
Update D:\xampp\php\php.ini and change the line
zend_extension = \xampp\php\ext\php_xdebug-3.0.2-8.0-vs16-x86_64.dll
Restart the webserver

Here is the installation summary-

Xdebug installed: 3.0.2
Server API: Apache 2.0 Handler
Windows: yes
Compiler: MS VS16
Architecture: x64
Zend Server: no
PHP Version: 8.0.0
Zend API nr: 420200930
PHP API nr: 20200930
Debug Build: no
Thread Safe Build: yes
OPcache Loaded: no
Configuration File Path: no value
Configuration File: D:\xampp\php\php.ini
Extensions directory: \xampp\php\ext

php.ini

[XDebug]
xdebug.remote_enable = 1
zend_extension = D:\xampp\php\ext\php_xdebug-3.0.2-8.0-vs16-x86_64.dll
xdebug.start_with_request=yes
xdebug.remote_autostart=1
xdebug.mode=debug
xdebug.discover_client_host = true

VS Code launch.json -

{
"version": "0.2.0",
"configurations": [
    {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9003,
        "pathMappings": {
            "your filepath": "${workspaceRoot}",
        }
    },
    {
        "name": "Launch currently open script",
        "type": "php",
        "request": "launch",
        "program": "${file}",
        "cwd": "${fileDirname}",
        "port": 9000
    }
  ]
}

回答1:


The following lines solved my problem -

in php.ini -

xdebug.remote_port = "9003"  //added this line

in launch.json

{

"version": "0.2.0",
"configurations": [
    {
        "name": "Listen for XDebug",
        "type": "php",
        "request": "launch",
        "port": 9003    //changed from 9000 to 9003
    },
    {
        "name": "Launch currently open script",
        "type": "php",
        "request": "launch",
        "program": "${file}",
        "cwd": "${fileDirname}",
        "port": 9003,  //added this line
        "runtimeExecutable": "D:\\xampp\\PHP\\php.exe"    //added this line
    }
]
}


来源:https://stackoverflow.com/questions/65941058/xdebug-v3-0-2-with-php-v8-0-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!