phpstorm + xdebug + docker

发布于:2023-03-12 ⋅ 阅读:(114) ⋅ 点赞:(0)

docker 中phpfpm安装xdebug插件


WX20200326-101557.png

  • xdebug.remote_host = docker.for.mac.localhost 远程IDE ip, 在mac docker desktop软件中,docker.for.max.localhost 代表宿主机ip
  • xdebug.remote_port = 9100 远程IDE监听的端口

phpstorm监听的xdebug端口


WX20200326-101634@2x.png

phpstorm 配置server,并添加文件映射


WX20200327-174321@2x.png
这个地址和端口是web访问的地址和端口
同时需要添加文件映射,即本地文件对应docker中的哪个文件

配置debug configure


WX20200326-101722@2x.png

调试


  1. 代码中设置断点
  2. 点击电话按钮进行监听
  3. 点击爬虫按钮获取调试的id
  4. 将id 拷贝到postman 使用

WX20200327-175111@2x.png

WX20200326-102648@2x.png

WX20200326-102744.png

WX20200326-103027@2x.png

防止调试超时


# php.ini  
max_execution_time = 7200

# php-fpm.conf 
request_terminate_timeout = 0

# nginx.conf
fastcgi_connect_timeout = 7200;
fastcgi_send_timeout = 7200;
fastcgi_read_timeout = 7200;
本文含有隐藏内容,请 开通VIP 后查看

网站公告

今日签到

点亮在社区的每一天
去签到