liuwenliang的个人博客分享 http://blog.sciencenet.cn/u/liuwenliang

博文

[转载]vscode增加xdebug扩展

已有 1768 次阅读 2019-4-27 14:28 |个人分类:php|系统分类:科研笔记|文章来源:转载

vscode增加xdebug扩展

复制代码

[xdebug]
; XDEBUG Extension
zend_extension = "C:/phpStudy/php56n/ext/php_xdebug-2.4.0-5.6-vc11-nts.dll"xdebug.remote_enable = on
xdebug.profiler_enable = on
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "D:/WWW/tmp"xdebug.show_local_vars=0;启用远程调试
xdebug.remote_autostart= 1

复制代码

  • C:/phpStudy/php56n/ext/php_xdebug-2.4.0-5.6-vc11-nts.dll 根据安装位置自定义设置

  • ctrl+shift+D 打开调试,点击小齿轮,选择相对应的语言(我这选择php),下拉框选择listen to xdebug

复制代码

{    "version": "0.2.0",
    "configurations": [
        {            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

复制代码

  • 鼠标在代码行号左边点击设置断点,F5,启动调试。

  • 在浏览器中输入相对应的访问地址,在调试-变量出即可看到断点的结果值

NOTICE:

  • php安装xdebug一直失败,最终发现是下载的 php_xdebug-2.4.0rc4-5.6-vc11-x86_64.dll 有误,改为nts后成功, php_xdebug-2.4.0-5.6-vc11-nts.dll 安装上后成功!

  • 断点使用:vscode中F5开启断点,在浏览器中访问后,将会直接跳至vscode中,按f5即可不断按照断点运行/停止。断点-变量中显示的数据是设置断点行之前的数据信息,不包括本行!

  • 安装后可能与其他编辑器的xdebug冲突,比如zendstudio默认含有xdebug插件,解决办法:更改zendstudio中xdebug插件的端口号,默认9000

 

Thanks

转自:https://www.cnblogs.com/wanghaokun/p/6103894.html



https://blog.sciencenet.cn/blog-3409972-1175798.html

上一篇:[转载]php开启xdebug扩展
下一篇:[转载]两种PHP邮件发送的方式
收藏 IP: 59.109.148.*| 热度|

0

评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-9-19 12:06

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部