php - 在 Ubuntu 中使用 VSCode 和 PHP (7) 调试器
问题描述
我在 Ubuntu 中使用 VSCode 来处理一个 php 项目。我使用 php 调试器扩展(和 xdebug)工作得很好,但现在它突然停止工作。(没有更新,没有改变配置。只是一个简单的重启计算机)。确切的问题是 VSCode 不会在代码中的断点处停止。
Netbeans 与 xdebug 配合得很好,所以我不知道什么会导致 VSCode 出现这个问题。
我应该尝试任何提示或想法?
提前致谢。
我已经更改了运行 xdebug 的端口,从 Internet 尝试不同的 launch.json,但不知道发生了什么。我最近激活了日志选项,并且我有一些来自 vscode 的输出,关于“格式错误的 HTTP 请求”,我想这是一个线索。
这是我设置的配置的launch.json 文件。(xdebug 位于 php.ini 文件中的 9090 端口)
{
// 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": 9090,
"log": true
},
{
"name": "Launch server",
"type": "php",
"request": "launch",
"program": "${workspaceRoot}/site/index.php",
"runtimeExecutable": "php",
"runtimeArgs": [
"-dzend_extension=/usr/lib/php/20170718/xdebug.so",
"-S",
"0.0.0.0:9090"
],
"cwd": "${workspaceRoot}",
"port": 9090,
"log" : true
}
]
}
VSCode 日志的输出:
<- launchResponse
Response {
seq: 0,
type: 'response',
request_seq: 2,
command: 'launch',
success: true }
<- outputEvent
OutputEvent {
seq: 0,
type: 'event',
event: 'output',
body:
{ category: 'stderr',
output:
'[Fri Nov 1 10:50:06 2019] 127.0.0.1:49922 Invalid request (Malformed HTTP request)\n' } }
解决方案
这很尴尬,但我用 CTROL + F5 执行 iDE,而不仅仅是 F5(我习惯于 Visual Studio)。
这就是整个问题...
谢谢!
推荐阅读
- sql - 如何对多个表使用联合联接,然后使用 WHERE 过滤它们
- node.js - schema.methods 与 schema.statics
- python - 如何在 Pandas 0.24.2 中将 offsets.MonthEnd 系列转换为 int
- android - 将诸如“5:4”之类的字符串转换为数值的最简单方法是什么
- bash - bash 中的三单引号是什么意思?
- c++ - 如何调用另一个类的函数?
- java - 将嵌套的 for 循环转换为维护数据的流
- javascript - 如何将数据从组件传递到包含我的数组的 .ts 文件?
- ios - 如何从应用扩展更新的sqlite文件中重新加载CoreData在主应用中的数据?
- python - 如何在游戏中添加计时器以在计时器达到 0 时重置游戏?