vscode的远程代码调试

本文介绍了如何在VSCode中安装相关插件,配置Xdebug进行PHP远程调试,包括yum安装、php.ini设置,以及创建并配置两个调试启动器,以便于在浏览器中进行调试。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.vscode安装相关插件

 

 

 

 连接

 选择第一个,输入ip ,然后配置用户名和密码就行了(之前配置过就会有记录可以快速链接)

xdebug调试

sudo yum install php-xdebug

安装完成后,在文件下添加:

zend_extension=xdebug.so
[XDebug]
xdebug.remote_enable = on
xdebug.start_with_request = 1
xdebug.mode=trace
xdebug.collect_includes = 1
xdebug.collect_params = 1
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.client_port=9000
xdebug.start_with_request=yes
xdebug.remote_log=/var/log/xdebug.log

在/etc/php.ini文件中添加同样内容
 

给json文件中添加如下内容(没有可以自己建,端口根据自己端口)

"version": "0.2.0",
    "configurations": [
        {
            "name": "Debug current script in console",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "externalConsole": false,
            "port": 9000
        },
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        }
 

 运行浏览器调试

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值