安装 remotessh
配置远程服务器连接秘钥进行登录
Host ubuntu
HostName 192.168.0.1
User root
Port 22
IdentityFile "C:\Users\xxx"
安装 phpdebug
在当前调试项目根目录建立 .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9003, // 必须与远程服务器php.ini xdebug.remote_port=9003 设置一致
},
]
}
远程服务器安装xdebug php 拓展
官方导引 https://xdebug.org/docs/install 如: Ubuntu (18.04 LTS/Bionic, 20.04 LTS/Focal): sudo apt-get install php-xdebug
修改php.ini配置激活xdebug远程调试
zend_extension = xdebug.so位置
[xdebug]
xdebug.remote_port=9003 // 与本地vscode .vscode/launch.json port保持一致
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.discover_client_host=On
max_execution_time = 3600
|