学习内容:
例如:
- 下载xdebug
- 配置php.ini
- 配置phpstorm中的Debug
- 配置需要调试的项目
- FAQ
学习产出:
一、下载xdebug
1、复制phpinfo()打印的数据;

链接:https://xdebug.org/wizard

2、根据返回的说明书,配置数据

二、配置php.ini
1、将下载的php_xdebug.dll放入 D:\phpstudy_pro\Extensions\php\php7.3.4nts\ext 中
2、进入php.ini中滑到最下边配置xdebug。
[Xdebug]
zend_extension=D:\phpstudy_pro\Extensions\php\php7.3.4nts\ext\php_xdebug.dll
xdebug.profiler_enable=On
xdebug.remote_enable=On
xdebug.auto_trace=On
xdebug.profiler_output_name=cachegrind.out.%t.%p
xdebug.profiler_output_dir="E:/WWW/tmp"
xdebug.show_local_vars=0
xdebug.remote_port=9001
xdebug.remote_host="localhost"
xdebug.idekey=phpstrom
xdebug.mode=debug
三、配置phpstorm中的Debug
1、点击 File -> settings -> PHP -> Debug ->DBGp Proxy根据php.ini中的配置填写。

2、点击 File -> settings -> PHP -> Debug -> Xdebug
3、验证成功,Information 中全部为正确,如有错误可以根据警告修改。

四、配置需要调试的项目
1、点击Run -> Edit Configurations,添加新配置 PHP Web Page

2、配置Server

3、phpstorm打断点,postman访问http://www.laraveltest.com/api/testcache,正常调试


FAQ
Q1、IDEA调试断点白色,断点无法生效

A1、解决方案
点击这个按钮即可解决。

Q2、xdebug报错端口不对,运行环境phpstudy
A2、点击软件管理 -> 设置 ->扩展组件配置这里的端口号

本文详细介绍了如何在phpstorm中配置xdebug,包括下载xdebug、php.ini设置、Debug配置以及处理常见问题如IDEA断点失效和xdebug端口错误。

2676

被折叠的 条评论
为什么被折叠?



