设为首页 加入收藏

TOP

phpstorm 2023 配置 xdebug
2023-09-09 10:25:35 】 浏览:242
Tags:phpstorm 2023 配置 xdebug

一、安装xdebug

下载Xdebug,要下载与PHP对应版本的Xdebug

xdebug官网下载地址:Xdebug: Downloads 这里下载的如果没有跟你的php对应,那么等待你的就是一堆报错

网站提供了一个自动分析系统对应的xdebug版本 ,网址是:

Xdebug: Support — Tailored Installation Instructions
在页面中需要粘贴进去php版本信息,也就是phpinfo()的信息

<?php
 phpinfo();
?>

  ctrl+A全选这个页面的信息,然后粘贴到Xdebug: Support — Tailored Installation Instructions 里

点击这个按钮:

 就可以看到对应你版本的xdebug下载

 

 按照上面提示的步骤,把文件放在php\ext目录里面。

 

二、设置php.ini

打开php.ini文件,把xdebug的配置加进去

看安装的xdebug版本是多少,2和3有些不一样

XDEBUG 3

[Xdebug]
zend_extension=D:/php目录/php7.3.4nts/ext/php_xdebug.dll
xdebug.idekey="PHPSTORM"  # 非常重要,务必记住
;配置端口和监听的域名
xdebug.mode=debug
xdebug.discover_client_host=true
xdebug.remote_cookie_expire_time = 3600
xdebug.client_port=9010
xdebug.client_host="localhost"
xdebug.start_with_request=yes
xdebug.remote_handler = "dbgp"

XDEBUG 2

;; debug2的
[Xdebug]
zend_extension=D:/php目录/php7.3.4nts/ext/php_xdebug.dll xdebug
.trace_output_dir=D:/phpTool/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.trace xdebug.profiler_output_dir=D:/phpTool/phpstudy_pro/Extensions/php_log/php7.3.4nts.xdebug.profiler xdebug.profiler_append = 0 xdebug.profiler_enable=On xdebug.profiler_enable_trigger = 0 ;开启远程调试 xdebug.remote_enable=On ;客户机xdebug调试协议 xdebug.remote_handler="dbgp" xdebug.remote_mode = "req" xdebug.remote_host=127.0.0.1 ;xdebug.remote_port修改默认值9000为9010(因为PHP-FPM默认监听9000端口,总是被占用),这里需要跟phpstorm配置一致 xdebug.remote_port=9010 ;idekey 区分大小写 xdebug.idekey="PHPSTORM" xdebug.collect_params=1 xdebug.collect_return=1 xdebug.auto_trace=On

 

二、设置phpstorm

 打开设置,File->Settings->PHP->Debug,填写php.ini中设置的端口号

 File->Settings->PHP->Debug->DBGp Proxy,填写php.ini中设置的内容

设置Servers,

Name起一个名字,Host填写本地host里配置的地址 

 

四、设置Run/Debug Configurations

编辑器右上角,选择Edit Configurations...

 添加一个配置,

点击加号,

 

Name起一个名字,Server选择刚刚创建的Servers

 

Run勾选上Break at first line in PHP scripts

 

配置完成。

 

五、测试

当用phpstorm进行debug调试的时候,记得开启监听模式

开启

 

关闭

 

在编辑器里打上断点,请求一下接口

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇接口参数在线查询 - 方便快捷的查.. 下一篇银行卡二要素验证API接口:支持银..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目