如何解决使用VScode和Xdebug调试php文件
我正在尝试在VScode上使用Xdebug,我已经阅读了很多有关它的文章,但也许它们不适合我的情况。我在Linux OpenSuse上,这是我所做的:
首先,我安装了php7-xdebug,并修改了/etc/php7/cli/php.ini和/etc/php7/conf.d/php.ini并添加:
zend_extension="/usr/lib64/php7/extensions/xdebug.so
xdebug.remote_autorestart=1
xdebug.remote_autostart=1
xdebug.remote_log=/var/log/xdebug.log
xdebug.remote_port = 9009
xdebug.idekey = VSCODE
在VSCode中,我安装了PHP调试扩展,打开了我的Web文件夹(我用于www文件的文件夹),并创建了一个配置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": 9009
},{
"name": "Launch currently open script","program": "${file}","cwd": "${fileDirname}","port": 9000
}
]
}
然后sudo systemctl启动nginx,sudo systemctl启动php-fpm,在示例代码中放置了断点。之后,我在左侧选择了Lisen作为XDebug并按下了播放键。什么也没发生,只有vscode的底部变成红色,没有消息,没有写任何地方(我可以看到)。
如果我尝试在调试控制台中写东西,答案是Cannot evaluate code without a connection
。
有人可以帮助我进行配置吗?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。