phpstorm配置xdebug

最近接手了一个laravel新项目,需要对laravel底层结构加深了解,决定使用xdebug进行代码调试。演示基于的web运行环境是本机下使用php内置的web服务器,phpstorm也支持在docker或者vagrant中运行xdebug

1:首先需要确定已经安装并开启xdebug扩展
phpstorm配置xdebug_第1张图片

这里的php环境是php7.3,xdebug版本是2.9.9

phpstorm配置xdebug_第2张图片

并且xdebug需要做相关配置

2:在phpstorm中配置xdebug

这里的phpstorm版本是2023.1
phpstorm配置xdebug_第3张图片

3:配置php解释器地址
phpstorm配置xdebug_第4张图片

4:配置xdebug行为

配置xdebug与phpstorm通信端口,默认xdebug2的端口是9000,xdebug3的端口是9003,phpstorm默认也是监听这两个端口
phpstorm配置xdebug_第5张图片

5:配置DBGp Proxy Servers
phpstorm配置xdebug_第6张图片
(这一步不太懂是干嘛 好像也不需要)

phpstorm配置xdebug_第7张图片

6:配置浏览器调试

phpstorm配置xdebug_第8张图片

这里可以通过Validate校验配置是否成功

7:检验效果

打断点,浏览器访问(必要时加参数XDEBUG_SESSION_START=1)

phpstorm配置xdebug_第9张图片

成功


参考:
1:https://www.jetbrains.com/help/phpstorm/configuring-xdebug.ht...

2: https://phpstorm.org/configuring-xdebug.html

你可能感兴趣的:(phplaravel)