我试图在Visual Studio Code中调试SFTP上托管的PHP应用程序。 实际上我正在使用" Php Debug"这个配置的插件:
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9001,
"serverSourceRoot": "/var/www/httpdocs/project",
"localSourceRoot": "${workspaceRoot}"
},
显然它不起作用,因为我没有设置DBGp代理或类似的东西。
因为这是为了工作,我的公司建议我使用PhpStorm并将我与此联系起来:
如何使用VSCode进行操作?
答案 0 :(得分:-1)
检查此答案!
DBGp代理客户端 从http://code.activestate.com/komodo/remotedebugging/下载 ,我使用Komodo-PythonRemoteDebugging-11.0.2-90813-linux-x86_64.tar
我的重击
#!/bin/bash
export PYTHONPATH=./pythonlib
python -c "import dbgp.client; print 'import lib ok'"
./pydbgpproxy -d 0.0.0.0:9999 -i 0.0.0.0:9001
然后运行
import lib ok
INFO: dbgp.proxy: starting proxy listeners. appid: 20018
INFO: dbgp.proxy: dbgp listener on 0.0.0.0:9999
INFO: dbgp.proxy: IDE listener on 0.0.0.0:9001
php xdebug.ini
xdebug.remote_handler = dbgp
xdebug.remote_host = 10.0.1.88 # DBGp ip
xdebug.remote_port = 9999 # DBGp port
带端口的ssh隧道
.ssh / config
# ...
RemoteForward 20000 localhost:20000 # vscode php-debug config
LocalForward 9001 localhost:9001 # DBGp port
# ...
并与ssh连接
"configurations": [
{
"name" : "vscphpdebug",
"type" : "php",
"request" : "launch",
"port" : 20000,
"stopOnEntry" : false,
"pathMappings": {
"/server/php": "${workspaceFolder}"
},
}
]
并在vscode中开始调试
$telnet 127.0.0.1 9001
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
proxyinit -p 20000 -k vscdebug -m 1
<?xml version="1.0" encoding="UTF-8"?>
<proxyinit success="1" idekey="vscdebug" address="0.0.0.0" port="9999"/>Connection closed by foreign host.
并停止DBGp使用此命令:proxystop -k vscdebug
$ telnet 127.0.0.1 9001
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
proxystop -k vscdebug
<?xml version="1.0" encoding="UTF-8"?>
<proxystop success="1" idekey="vscdebug"/>Connection closed by foreign host.
调试愉快!