虚拟机CentOS7下安装php7 Xdebug,本地VScode配置

简介

开发多年一直没有打断点的习惯,前几天被说了,于是安装了相关插件,在此做个笔记

Xdebug下载安装
  1. 首先要去Xdebug的官网去下载source包
  2. 首先要解压下载好的source包(tar -zxvf xsdebug***)
  3. 进入目录(phpize)
  4. 运行./configure,可手动指定php的配置路径(./configure --enable-xdebug --with-php-config=/usr/local/php-7.2.4/bin/php-config)
  5. 运行make && make install
  6. 成功安装后按提示在php.ini中配置(以下是我本地的相关配置,便于大家参考,zend_extension=xdebug.so之前是extension=xdebug.so,但会报错,此配置)
zend_extension=xdebug.so
[Xdebug]
#xdebug 监听端口
xdebug.remote_port = 9999
#是否开启远程调试
xdebug.remote_enable = on
xdebug.remote_autostart = 1
#远程调试的域名
#xdebug.remote_host = http://www.httouch.cn/
xdebug.remote_connect_back = 1
#远程调试的处理方式
xdebug.remote_handler = dbgp
#xdebug 会话标识, 任意配置
xdebug.idekey = vscode-xdebug
xdebug.collect_params = 1
xdebug.collect_return = 1
xdebug.auto_trace = 0
xdebug.profiler_enable = 0
xdebug.max_nesting_level = 1000000
xdebug.remote_log = /var/log/xdebug.log
  1. 配置成功后重启php,执行php -m查看是否安装成功

本地VScode配置

  1. 应用中搜索php debug(安装第一个扩展)
    在这里插入图片描述
  2. 修改launch.json中内容在这里插入图片描述
{
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "stopOnEntry":false,
            "localSourceRoot": "${workspaceRoot}",
            "serverSourceRoot": "/data/www/HTTouch", //虚拟机中项目路径
            "port": 9999
        }
  1. 至此一切准备就绪,f5运行,并打开断点页面
    在这里插入图片描述
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值