给新装的虚拟机安装lamp环境,安装到xdebug的时候突然怎么也断不下来,怎么回事???原来是xdebug新版本的配置文件写法有了变化:
版本为2.xx的xdebug:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
PHP Debug Adapter for Visual Studio Code 一文中对3.xx版本的xdebug配置变化进行了说明:
Enable remote debugging in your
php.ini
:For XDebug v3.x.x:
xdebug.mode = debug xdebug.start_with_request = yes xdebug.client_port = 9000
For XDebug v2.x.x:
xdebug.remote_enable = 1 xdebug.remote_autostart = 1
所以新版配置如下:
zend_extension=xdebug.so
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.remote_host=127.0.0.1
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
vscode lauch.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": 9000},{"name": "Launch currently open script","type": "php","request": "launch","program": "${file}","cwd": "${fileDirname}","port": 9000}]
}端口记得对应上