Xdebug v3.0.2 с PHP версии 8.0.0

#php #visual-studio-code #xdebug #php-8

#php #visual-studio-code #xdebug #php-8

Вопрос:

Я только что перешел на php v8.0.0 с помощью XAMPP v3.2.4. Но Xdebug не работает. Выполнение не останавливается в точках останова.

Мои инструкции по установке-

 Download php_xdebug-3.0.2-8.0-vs16-x86_64.dll
Move the downloaded file to xamppphpext
Update D:xamppphpphp.ini and change the line
zend_extension = xamppphpextphp_xdebug-3.0.2-8.0-vs16-x86_64.dll
Restart the webserver
 

Вот краткое описание установки-

 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:xamppphpphp.ini
Extensions directory: xamppphpext
 

php.ini

 [XDebug]
xdebug.remote_enable = 1
zend_extension = D:xamppphpextphp_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:

Следующие строки решили мою проблему —

в php.ini —

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

в 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
    }
]
}