docker里宝塔面板如何开启php xdebug远程调试?

2023-04-1207:39:11服务器及运维Comments1,062 views字数 571阅读模式

开发软件:phpstorm
PHP版本:7.4.33
xdebug版本:3.1.6文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

一、登录宝塔面板,找到“软件商店”-“已安装”选择你使用的php软件,然后点击设置(如下图)。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

docker里宝塔面板如何开启php xdebug远程调试?

二、安装xdebug扩展(如下图)。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

docker里宝塔面板如何开启php xdebug远程调试?

三、通过phpinfo()查看xdebug版本和是否安装成功。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

docker里宝塔面板如何开启php xdebug远程调试?

四、继续打开第二步的设置界面,找到“配置文件”,在末尾处添加以下参数(如下图)。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

docker里宝塔面板如何开启php xdebug远程调试?
[xdebug]
xdebug.client_port=9003
xdebug.mode=debug
xdebug.discover_client_host=1
xdebug.client_host=host.docker.internal
xdebug.idekey = PHPSTORM
xdebug.start_with_request=yes

五、打开phpstorm软件,并打开设置(如下图),按图上的进行设置。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

docker里宝塔面板如何开启php xdebug远程调试?

六、开启监听,设下断点,发起请求,完成。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

最后说一下,我碰到的问题,使用Thinkphp开发的项目。在某个控制器里下断点。发现总是提示如下问题:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

调试会话已完成且未暂停:这可能是由于路径映射配置错误或本地和远程项目未同步。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

只能一直在入口文件处下断点,无法在控制器文件里下断点。这是由于路径映射没有设置正确。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

PHPStorm自动设置的不一定是正确的,自己注意检查并修改为正确的,才能正常调试。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

docker里宝塔面板如何开启php xdebug远程调试?

 文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html

文章源自菜鸟学院-https://www.cainiaoxueyuan.com/yunwei/33276.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/yunwei/33276.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定