1.在php.ini文件结尾加上
zend_extension = php_xdebug.dll
xdebug.remote_enable = On
xdebug.remote_host = 127.0.0.1
xdebug.remote_port = 9100
xdebug.remote_autostart = On
2.设置PhpStorm
打开PhpStorm,菜单 File -> Settings ,然后找到 Languages & Frameworks -> PHP -> Debug
设置Debug port为9100
因为9000会和一些集成环境的php-cgi或者php-fpm端口冲突.
然后配置Languages & Frameworks -> PHP -> Servers
3.重点:触发PhpStorm的debug方式主要有两种
GET、POST存在XDEBUG_SESSION_START 参数或者cookie里存在XDEBUG_SESSION,单用户调试 值随意。GET、POST会生成cookie XDEBUG_SESSION,有效期为1个小时(可修改php.ini配置)。
很多教程需要下载Xdebug helper等浏览器插件,原理就是请求里附加cookie。
php.ini 文件 xdebug.remote_autostart 参数设置为 On 或者1,无需设置GET、POST、cookie。
点击
点击
即开启了调试
此时请求会带有
路径在/后面修改即可
如
即可看到进入了指定的断点
参考资料:
https://blog.csdn.net/qq_34087545/article/details/89490269