Xdebug + Postman 调试环境配置
https://blog.csdn.net/wuxing164/article/details/108592574
开启 postman 的 phpstorm 调试功能大致如下:
- 一般会在配置文件 php.ini 的 xdebug 配置中指定 idekey 。
[xdebug] xdebug.remote_enable = on # 启用远程调试 xdebug.remote_host = 127.0.0.1 xdebug.remote_port = 9010 # 监听端口 xdebug.remote_handler = dbgp xdebug.idekey = PHPSTORM xdebug.remote_log = /tmp/xdebug.log ......
-
打开 postman ,右边找到 Cookies 。
-
点击 Cookies ,填入 XDEBUG_SESSION=PHPSTORM ,之后即可调起 phpstorm 的调试功能
-
在 Headers 中新增 {KEY:Cookie,VALUE:XDEBUG_SESSION=PHPSTORM}
-
然后发起 send 请求,由 PHPstorm 捕捉,成功进入断点。
注意: 若是还无法成功捕捉断点,可以在 Headers 里新增 XDEBUG_SESSION_START 的值尝试一下。
![XDEBUG_SESSION_START 值value](https://img-blog.csdnimg.cn/img_convert/990b4126e279d68c4c626eeb42de2201.png)
其中,XDEBUG_SESSION_START 的值在 PHPstorm 开启调试的右上角 Debugger 中可以找到。
![Run and Debugger](https://img-blog.csdnimg.cn/img_convert/8b666e5c2126f217116bbae8130bf090.png)
点击 Run 或者 甲壳虫Debug ,执行将会打开游览器,在 URL地址栏 中找到 ?XDEBUG_SESSION_START=PHPPHPSTORM ,将值填入即可
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1.run->edit configurations
![](https://img-blog.csdnimg.cn/img_convert/9f485d5b251e1be2e074a060af6a698d.png)
StartUrl最好是网址,不然容易出错,Server选择的是配置时添加的Servers,详可参考:http://www.cnblogs.com/cxscode/p/7045944.html
2. Chrome谷歌浏览器的扩展我安装了两个,并且都开启了
JetBrains IDE Support 百度网盘:http://pan.baidu.com/s/1cw9Heu 密码:rw01
xdebug helper for chrome百度网盘:链接:http://pan.baidu.com/s/1i5DW11b 密码:u29d
![](https://img-blog.csdnimg.cn/img_convert/f2b542d75ab630c17ae14f5cb53a1ad0.png)
3.访问页面准备进入断点时,PHPStorm报错:Cannot accept external Xdebug connection: Cannot evaluate expression'isset($_SERVER['PHP_IDE_CONFIG'])';
导致此问题的一个可能原因是:服务器端的php.ini中配置了:
extension=/path/xdebug.so
应该只保留下面一个:
zend_extension=/path/xdebug.so
4.另外端口9000最好改成9001,phpstorm和xdebug要同步,IDEkey同理,要保持一致
![](https://img-blog.csdnimg.cn/img_convert/d86c327ee91e6accd484acdcf9c19729.png)
![](https://img-blog.csdnimg.cn/img_convert/f65e288d62cc7b74448ad218b6da7a24.png)
![](https://img-blog.csdnimg.cn/img_convert/0acfe207c7e7d1a2b3cc7c2281ef7403.png)