VsCode配置php调试环境

  1. 在VsCode中配置PHP可执行文件路径php.validate.executablePath
    可执行路径

  2. 下载对应的Xdebug组件

  • 利用phpinfo()查看自己php编译环境
    查看VC版本和是否为NTS
  • xdebug
    中下载对应的dll
  1. 在VsCode中下载php debug扩展

  2. 修改php.ini文件

    [XDebug]

    zend_extension = D:\phpStudy\PHPTutorial\php\php-7.0.12-nts\ext\php_xdebug-2.6.1-7.0-vc14-nts.dll

    xdebug.remote_enable = 1

    xdebug.remote_autostart = 1

更详细的配置选项参考参考链接

;是否开启自动跟踪
xdebug.auto_trace = On
;是否开启异常跟踪
xdebug.show_exception_trace = On
;是否开启远程调试自动启动
xdebug.remote_autostart = On
;是否开启远程调试
xdebug.remote_enable = On
;允许调试的客户端IP
xdebug.remote_host=192.168.1.107
;远程调试的端口(默认9000)
xdebug.remote_port=9000
;调试插件dbgp
xdebug.remote_handler=dbgp
;是否收集变量
xdebug.collect_vars = On
;是否收集返回值
xdebug.collect_return = On
;是否收集参数
xdebug.collect_params = On
;跟踪输出路径
xdebug.trace_output_dir="c:\xdebug"
;是否开启调试内容
xdebug.profiler_enable=On
;调试输出路径
xdebug.profiler_output_dir="c:\xdebug"

  1. 设置好断点之后开始调试,使用浏览器访问需要调试的页面即可
posted @ 2021-04-27 20:01  掉到鱼缸里的猫  阅读(465)  评论(0编辑  收藏  举报