前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >PHPStudy + VSCode 进行 PHP 断点调试

PHPStudy + VSCode 进行 PHP 断点调试

原创
作者头像
Action
修改2021-08-12 18:15:53
2.1K0
修改2021-08-12 18:15:53
举报
文章被收录于专栏:WEB开发~

下载和配置PHPStudy

开启Nginx

设置里面的扩展组件里面的XDebug调试组件打开

修改php.ini

增加Xdebug的配置

代码语言:txt
复制
[Xdebug]
zend_extension=D:/phpstudy_pro/Extensions/php/php7.3.4nts/ext/php_xdebug.dll
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.auto_trace=On
xdebug.trace_output_dir=D:/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.trace
xdebug.profiler_enable=On
xdebug.profiler_output_dir=D:/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.profiler
xdebug.remote_enable=On
xdebug.remote_autostart = On
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_handler=dbgp

VSCode的配置

安装插件php debug

安装好后就要设置php.exe的路径

文件->首选项->设置->扩展->php->validate:executable path

添加php.ext的执行路径:"php.validate.executablePath": "D:\phpstudy_pro\Extensions\php\php7.3.4nts\php.exe",根据自己选择的php版本找到相应的php.exe路径,然后保存重启VSCode

最后配置launch.json,也就是调试模式点设置,端口号保持一致就行了

代码语言:txt
复制
{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9001,
        },
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9001
        }
    ]
}

测试

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 下载和配置PHPStudy
  • VSCode的配置
  • 测试
相关产品与服务
检测工具
域名服务检测工具(Detection Tools)提供了全面的智能化域名诊断,包括Whois、DNS生效等特性检测,同时提供SSL证书相关特性检测,保障您的域名和网站健康。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档