首先要安装xdebug扩展 我本地是phpstudy环境 要用phpinfo()查看php信息对应着信息去下载xdebug
Xdebug: Downloadsxdebug.org把扩展php_xdebug-2.7.0alpha1-7.2-vc15-nts.dll放到php的扩展目录(ext文件中)
我的位置D:phpStudyPHPTutorialphpphp-7.1.13-ntsext
打开php.ini文件,配置如下:
[XDebug]
zend_extension=D:phpStudyPHPTutorialphpphp-7.1.13-ntsextphp_xdebug-2.9.6-7.1-vc14-nts.dll
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir ="D:phpStudytmpxdebug"
xdebug.trace_output_dir ="D:phpStudytmpxdebug"
xdebug.profiler_output_name = "cache.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9000
xdebug.remote_mode = "req"
xdebug.idekey = PHPSTORM
说明:改项也可以写绝对路径
zend_extension=D:phpStudyPHPTutorialphpphp-7.2.1-ntsextphp_xdebug-2.9.6-7.1-vc14-nts.dll
在查看phpinfo中是否有xdebug扩展开启,如果没有xdebug信息(可能是VC版本不对,见底部说明),说明版本不对或配置错误(我明明是64位的 却安装不上 不显示出来 结果安装32位的就好了)
或者在cmd窗口输入php -m命令查看扩展,注意如果报命令无效时,要添加php.exe到环境变量中
如果进行断点调试如何使用xdebug断点调试代码??
当然如果你还没有安装phpstorm,请自行安装!(私聊给)
下面进入正题,首先第一步打开设置 file->Settings 或快捷键ctrl+alt+s
选择php版本
debug的配置 php.ini设置的远程端口
phpstorm添加php服务
DBGP proxy设置
添加配置
添加测试文件,设置断点
postman 添加 cookie
如果提示这个
可能有问题的地方:
由于断点没有被监听到,可能是断点打错了地方
我这个暂时有点失败了 有时间在调试下