美文网首页
PhpStorm + XDebug 断点调试配置

PhpStorm + XDebug 断点调试配置

作者: linceln | 来源:发表于2018-01-17 13:54 被阅读15次

Windows

php.ini 配置

[XDebug]
; 插件位置,绝对路径
zend_extension="D:\phpStudy\php\php-5.6.27-nts\ext\php_xdebug.dll"
; 开启远程调试
xdebug.remote_enable=1
; 没有带 XDEBUG_SESSION_START 参数也会尝试进入调试模式
xdebug.remote_autostart=1
; 忽略 xdebug.remote_host 的设置,返回发出请求的 IDE 的 IP
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_mode=req
xdebug.idekey='PHPSTORM'

Docker

安装 xdebug 插件,构建镜像

FROM php:7-fpm

RUN apt-get update \ 
&& pecl install xdebug \
&& docker-php-ext-enable xdebug

通过 Volume 配置 php.ini

[XDebug]
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9001
xdebug.remote_mode=req
xdebug.idekey='PHPSTORM'

PhpStorm 配置

Debug port 与 php.ini 中配置的 remote_port 保持一致 点击后开始监听调试

Chrome 浏览器配置

安装 Chrome 插件 Xdebug helper
Xdebug helper 配置
点击 Debug 开始调试,图标变绿
打上断点,测试成功

Postman 配置
需要调试的地址带上XDEBUG_SESSION_START参数即可

www.xxx.com?XDEBUG_SESSION_START=PHPSTORM

相关文章

网友评论

      本文标题:PhpStorm + XDebug 断点调试配置

      本文链接:https://www.haomeiwen.com/subject/dleeixtx.html