phpstorm 调试_PhpStorm中的多用户调试

2023-11-17

phpstorm 调试

by Ray Naldo

雷·纳尔多(Ray Naldo)

PhpStorm中的多用户调试 (Multi-User Debugging in PhpStorm)

使用Xdebug和DBGp代理 (Using Xdebug and DBGp Proxy)

“Er, wait a minute… Don’t you just use xdebug.remote_connect_back which has been introduced since Xdebug 2.1?"

“嗯,请稍等...您不只是使用Xdebug 2.1之后引入的xdebug.remote_connect_back吗?”

Sure if the web server is only accessible by the developers (e.g. private development server), and if it’s not running behind a NATted firewall, and if you want this guide to end here. See those IFs? Personally, I don’t like IF in programming or in life. So this guide will take the longer way which doesn’t need an IF to start (or at least fewer IFs), that is by using Xdebug’s DBGp proxy.

确保Web服务器仅可由开发人员访问(例如,私有开发服务器),并且它不在NATted防火墙后面运行,以及是否希望本指南在此处结束。 看到那些IF吗? 就个人而言,我在编程或生活中都不喜欢IF。 因此,本指南将采用更长的方式,即不需要使用IF(或者至少需要更少的IF)来启动,即使用Xdebug的DBGp代理。

When a proxy is used, the PHP Xdebug extension no longer connects to PhpStorm directly, but instead connects to the DBGp proxy server. All developers in the team, in turn, then connect to that proxy. Each developer has a separate debugging session running over this proxy, which makes it possible to do multi-user debugging of the same code on the same server.

使用代理时,PHP Xdebug扩展不再直接连接到PhpStorm,而是连接到DBGp代理服务器。 然后,团队中的所有开发人员都将连接到该代理。 每个开发人员都在此代理上运行单独的调试会话,这使得可以对同一服务器上的相同代码进行多用户调试。

So, with DBGp proxy you can limit who can connect to the proxy, and you may have multiple developers debugging the same web server running behind a NATted firewall.

因此,使用DBGp代理,您可以限制谁可以连接到代理,并且可能有多个开发人员调试在NATted防火墙后运行的同一Web服务器。

Running a DBGp proxy also allows you to avoid NAT issues where (as seen from PHP+Xdebug on the server) all connections seem to come from the same IP (because your internal network is NATted). In this case, you can simply run the dbgp proxy on your NAT machine, configure xdebug.remote_host setting to the IP address of your NAT machine, and configure the IDEs to connect to the proxy running at <NAT-machine>;:9001.

运行DBGp代理还可以避免NAT问题(如从服务器上PHP + Xdebug看到的),所有连接似乎都来自同一IP(因为您的内部网络已被NAT)。 在这种情况下,您只需在NAT计算机上运行dbgp代理,将xdebug.remote_host设置配置为NAT计算机的IP地址,然后将IDE配置为连接到运行在<NAT-machine>上的代理; :9001。

https://derickrethans.nl/debugging-with-multiple-users.html

https://derickrethans.nl/debugging-with-multiple-users.html

建立 (Setup)

Mappings between the project folders and the folders on the server should be done correctly in PhpStorm first for debugging to work.

应该首先在PhpStorm中正确完成项目文件夹和服务器上的文件夹之间的映射,然后才能进行调试。

设置Web服务器 (Setup Web Server)

Although this guide assumes the web server is running on Linux, the guide could also be used on non-Linux web servers with slight modifications.

尽管本指南假定Web服务器在Linux上运行,但该指南也可以在非Linux Web服务器上使用,并稍加修改。

1. Install Xdebug.

1.安装Xdebug。

# PHP 7+pecl install xdebug  # PHP 5.6.xpecl install xdebug-2.5.5

2. Enable Xdebug extension, then add the following Xdebug configuration to php.ini:

2.启用Xdebug扩展,然后将以下Xdebug配置添加到php.ini:

[xdebug]zend_extension="<full_path_to_xdebug.so>"
; debugger settingsxdebug.remote_enable=1xdebug.remote_host=127.0.0.1xdebug.remote_port=9000

For this guide, DBGp proxy will run on the same machine as the web server and will use Xdebug’s default port, hence 127.0.0.1:9000.

对于本指南,DBGp代理将与Web服务器在同一台计算机上运行,​​并将使用Xdebug的默认端口,即127.0.0.1:9000

3. Download and install DBGp proxy for remote debugging from Komodo Remote Debugging Package, specifically for your web server’s operating system. This guide will be using 64-bit Linux and PHP Remote Debugging client v11.1.0. Extract the archive; for simplicity I extract all the contents to my home directory i.e. /home/ray/.

3.从Komodo Remote Debugging Package中下载并安装DBGp代理,以进行远程调试,特别是针对Web服务器的操作系统。 本指南将使用64位Linux和PHP远程调试客户端v11.1.0。 提取档案; 为简单起见,我将所有内容提取到我的主目录(即/home/ray/

4. Run DBGp proxy by executing pydbgpproxy file with parameters:

4.通过执行带有参数的pydbgpproxy文件来运行DBGp代理:

  • -d <ip_address:port> to set IP address and port of the machine which will be receiving debugger connection from the web server

    -d <ip_address:po rt>设置将要从Web服务器接收调试器连接的计算机的IP地址和端口

  • -i <ip_address:port> to set IP address and port of the machine which will be receiving debugging connection from developer computer

    -i <ip_address:po rt>设置将要从开发人员计算机接收调试连接的计算机的IP地址和端口

In this guide, web server and DBGp proxy will be run on the same machine. If the IP address is 10.211.1.32 and we want to run the proxy on port 9001 then the command will be:

在本指南中,Web服务器和DBGp代理将在同一台计算机上运行。 如果IP地址为10.211.1.32并且我们想在端口9001上运行代理,则命令将为:

pydbgpproxy -d 127.0.0.1:9000 -i 10.211.1.32:9001

For convenience we could use this script, saved as start-dbgp-proxy.sh.I placed it on the same directory as pydbgpproxy i.e. /home/ray/start-dbgp-proxy.sh) :

为方便起见,我们可以使用这个脚本,保存为start-dbgp-proxy.sh 。我把它放在同一个目录中pydbgpproxy/home/ray/start-dbgp-proxy.sh ):

ip=$(hostname -I | awk '{$1=$1};1')pydbgpproxy -d 127.0.0.1:9000 -i $ip:9001

5. Make sure to allow connection from localhost on port 9000, and from developer machines on port 9001.

5.确保允许从端口9000上的localhost和端口9001上的开发人员机器进行连接。

6. Run start-dbgp-proxy.sh. Add execute file permission if you can't run it.

6.运行start-dbgp-proxy.sh 。 添加执行文件权限(如果无法运行)。

start-dbgp-proxy.sh

Make sure it can be run without a problem.

确保它可以正常运行。

INFO: dbgp.proxy: starting proxy listeners.  appid: 30430INFO: dbgp.proxy:     dbgp listener on 127.0.0.1:9000INFO: dbgp.proxy:     IDE listener on  10.211.1.32:9001

7. (Optional) Auto-start start-dbgp-proxy.sh on each machine startup by using crontab.

7.(可选)使用crontab在每次启动计算机时自动启动start-dbgp-proxy.sh

Edit crontab:

编辑crontab:

crontab -e

Add cron job to auto-start start-dbgp-proxy.sh on each startup:

在每次启动时将cron作业添加到自动启动start-dbgp-proxy.sh

@reboot /home/ray/start-dbgp-proxy.sh

设置客户端 (Setup Client)

1. Access menu Tools > DBGp Proxy > Register IDE on PhpStorm.

1.在PhpStorm上访问菜单Tools > DBGp Proxy > Regist IDE。

2. Fill IDE key with unique string between developers. FillHost andPort with DBGp proxy's IP address and port (parameter -i on Setup Server #4).

2.用开发人员之间的唯一字符串填充IDE key 。 用DBGp代理的IP地址和端口(在Setup Server#4上的参数-i )填充HostPort

3. Click OK. You should see a success notification popup. If you don’t see it, re-register IDE via Tools > DBGp Proxy > Register IDE. If it's failed or you want to change the configuration, do it via Tools > DBGp Proxy > Configuration...

3.单击确定。 您应该看到一个成功通知弹出窗口。 如果看不到,请通过Tools > DBGp Proxy > Regist IDE重新注册IDE。 如果失败或要更改配置,请不要t via Tools > DBGp Proxy > Conf配置” ...

4. (Optional) If you want to initiate debugging connection from the web browser, it’s recommended to install a debugging extension on your browser: Xdebug Helper Firefox or Xdebug Helper Chrome. Then configure your Xdebug Helper.

4.(可选)如果要通过Web浏览器启动调试连接,建议在浏览器上安装调试扩展程序: Xdebug Helper FirefoxXdebug Helper Chrome 。 然后配置您的Xdebug助手。

On Firefox, right click Xdebug Helper icon > Manage Extension… > Options On Chrome, right click Xdebug Helper icon > Options

在Firefox上,右键单击Xdebug Helper图标>管理扩展…>选项在Chrome上,右键单击Xdebug Helper图标>选项

Fill and save IDE key with the same unique string as when you're registering the IDE (Step #2).

使用与注册IDE时相同的唯一字符串填充并保存IDE key ( 第2步 )。

开始调试 (Start Debugging)

1. Set breakpoint(s) on PhpStorm.

1.在PhpStorm上设置断点。

2. Start listening to debug connection in PhpStorm by clicking the ‘phone’ button on the upper right toolbar or from menu Run > Start Listening for PHP Debug Connections. This will enable PhpStorm to react and opens the Debug window automatically when a debugging session is started.

2.单击右上方工具栏上的“电话”按钮,或从菜单中的Run > Start Listening for PHP Debug Connecti PhpStorm中的Run > Start Listening for PHP Debug Connecti 。 启动调试会话时,这将使PhpStorm作出React并自动打开“调试”窗口。

3. Activate Xdebug’s debugger when doing a request. According to Xdebug Documentation there’re 3 ways to do this. But IMHO, the best way which works for all kinds of HTTP methods is by setting a cookie named XDEBUG_SESSION with value <IDE_key> which is the same unique string when we register our IDE to DBGp proxy (Setup Client #2).

3.在执行请求时激活Xdebug的调试器。 根据Xdebug文档,有3种方法可以做到这一点。 但是恕我直言,适用于所有HTTP方法的最佳方法是设置一个名为XDEBUG_SESSION的cookie,其值为<IDE_k ey>,当我们将IDE注册到DBGp poxy (安装程序 #2)时,该cookie是相同的唯一字符串。

  • In the web browser, the cookie will be set automatically by Xdebug Helper extension

    在Web浏览器中,将通过Xdebug Helper扩展自动设置cookie。
  • In Postman, the cookie can be set in Request Headers

    在邮递员中,可以在“请求标题”中设置Cookie

4. Run the script with the cookie already set.

4.在已设置cookie的情况下运行脚本。

5. On success, PhpStorm will show the Debug window automatically.

5.成功后,PhpStorm将自动显示“调试”窗口。

6. Make sure to unset/don’t send the cookie to disable debug and stop listening debug connection in PhpStorm if you’re not doing any debugging. If you fail to do so, it will make the DBGp proxy hang when there’s too many hanging connections.

6.如果您不进行任何调试,请确保取消设置/不发送cookie来禁用调试并停止监听PhpStorm中的调试连接。 如果您这样做失败,则当挂起的连接过多时,它将使DBGp代理挂起。

Hope this guide works for you.

希望本指南对您有用。

Thank you for reading!

感谢您的阅读!

参考文献 (References)

翻译自: https://www.freecodecamp.org/news/multi-user-debugging-in-phpstorm-75ef628ed50f/

phpstorm 调试

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

phpstorm 调试_PhpStorm中的多用户调试 的相关文章

  • Java中的DRY原则[关闭]

    Closed 这个问题需要细节或清晰度 help closed questions 目前不接受答案 我一直在读关于DRY https en wikipedia org wiki Don 27t repeat yourself原则 虽然看起来
  • 当容器大小更改时,JTable 仅调整选定列的大小

    对于面板内的 JTable 如果面板变大 我如何将额外的空间仅分配给某些列 在我的例子中 分配给最后一列 尽管提供 第 3 4 列和8 将获得额外的空间 我想允许用户手动更改所有列的列大小 我尝试了 table setAutoResizeM
  • 如何测试“If-Modified-Since”HTTP 标头支持

    使用 PHP 如何准确测试远程网站supports If Modified Since HTTP 标头 据我所知 如果您获取的远程文件自标头请求中指定的日期以来已被修改 它应该返回 200 OK 状态 如果尚未修改 则应返回 304 Not
  • 别碰我的女人

    我讨厌的一件事迪斯图尔斯 http docs python org distutils 我猜他是邪恶的人 他这样做了 https github com python cpython blob 300dd552b15825abfe0e367a
  • 从 python 中的缩进文本文件创建树/深度嵌套字典

    基本上 我想迭代一个文件并将每行的内容放入一个深层嵌套的字典中 其结构由每行开头的空格数量定义 本质上 目标是采取这样的事情 a b c d e 并将其变成这样的东西 a b c d e Or this apple colours red
  • 如何在 Linux x86_64 上模拟 iret

    我正在编写一个基于 Intel VT 的调试器 由于当 NMI Exiting 1 时 iret 指令在 vmx guest 中的性能发生了变化 所以我应该自己处理vmx主机中的NMI 否则 guest会出现nmi可重入错误 我查了英特尔手
  • 存储过程将多个表返回到 spring jdbc 模板

    我正在使用 JdbcTemplate 从 Spring DAO 类调用存储过程 我的问题是 存储过程返回多个表 有没有办法使用 Spring JdbcTemplate 访问多个表 如果我使用jdbcTemplate queryForList
  • 从 Apache 运行 python 脚本的最简单方法

    我花了很长时间试图弄清楚这一点 我基本上正在尝试开发一个网站 当用户单击特定按钮时 我必须在其中执行 python 脚本 在研究了 Stack Overflow 和 Google 之后 我需要配置 Apache 以便能够运行 CGI 脚本
  • RMI 服务器:rmiregistry 或 LocateRegistry.createRegistry

    对于服务器端的RMI 我们需要启动吗rmiregistry程序 或者只是调用LocateRegistry createRegistry 如果两者都可以的话 各有什么优点和缺点 他们是同一件事 rmiregistry是一个单独的程序 您可以从
  • Scikit Learn - K-Means - 肘部 - 标准

    今天我想学习一些关于 K means 的知识 我已经了解该算法并且知道它是如何工作的 现在我正在寻找正确的 k 我发现肘部准则作为检测正确的 k 的方法 但我不明白如何将它与 scikit learn 一起使用 在 scikit learn
  • 如何表示类的实例与将其作为输入的类之间的关系?

    我有一堂课叫House 这个类的实例是house class House def init self height length self height height self length length def housePlan hou
  • java中的比较器链

    正在阅读Oracle 关于接口的 Java 教程 https docs oracle com javase tutorial java IandI createinterface html其中给出了一个例子Card 打牌 我试图理解接口中的
  • SpaCy 中的自定义句子边界检测

    我正在尝试在 spaCy 中编写一个自定义句子分段器 它将整个文档作为单个句子返回 我编写了一个自定义管道组件 它使用以下代码来执行此操作here https github com explosion spaCy issues 1850 但
  • 使用Python重命名目录中的多个文件

    我正在尝试使用以下 Python 脚本重命名目录中的多个文件 import os path Users myName Desktop directory files os listdir path i 1 for file in files
  • 使用 Android 的 Mobile Vision API 扫描二维码

    我跟着这个tutorial http code tutsplus com tutorials reading qr codes using the mobile vision api cms 24680关于如何构建可以扫描二维码的 Andr
  • Django - 缺少 1 个必需的位置参数:'request'

    我收到错误 get indiceComercioVarejista 缺少 1 个必需的位置参数 要求 当尝试访问 get indiceComercioVarejista 方法时 我不知道这是怎么回事 views from django ht
  • 将隐藏(生物识别)数据附加到 pdf 上的数字签名

    我想知道是否可以使用 iText 我用于签名 或 Java 中的其他工具在 pdf 上添加生物识别数据 我会更好地解释一下 在手写板上签名时 我会收集签名信息 例如笔压 签名速度等 我想将这些信息 java中的变量 与pdf上的签名一起存储
  • 使用命令行将 MediaWiki 维基文本格式转换为 HTML

    我倾向于编写大量文档 因此 MediaWiki 格式对我来说很容易理解 而且比编写传统 HTML 节省了我很多时间 然而 我也写了一篇博客 发现一直从键盘切换到鼠标来输入正确的 HTML 标签会增加很多时间 我希望能够使用 Mediawik
  • 如何使用 Spring AOP 建议静态方法?

    在执行类的静态方法之前和之后需要完成一些日志记录 我尝试使用 Spring AOP 来实现这一点 但它不起作用 而对于正常方法来说它起作用 请帮助我理解如何实现这一点 如果可以使用注释来完成 那就太好了 也许您应该在使用 Spring AO
  • 从 Flask 中的 S3 返回 PDF

    我正在尝试在 Flask 应用程序的浏览器中返回 PDF 我使用 AWS S3 来存储文件 并使用 boto3 作为与 S3 交互的 SDK 到目前为止我的代码是 s3 boto3 resource s3 aws access key id

随机推荐

  • elasticsearch的映射 (mapping)

    一 概念 映射 mapping 就是指定索引 index 里面的每个文档中的字段的类型 设置字段的存储和查询的分析策略 es对不同的字段类型 有不同的存储和检索策略 比如对于text类型的字段 会经过各类分词处理 大小写转换 同义词转换 才
  • VTK5.10.1+Cmake+vs2010整合安装

    1 下载 VS2010就自己在网上找了咯 这里不提供具体路径下载了 vtk 5 10 1 zip源程序 vtkdata 5 10 1 zip 数据 vtkDocHtml 5 10 1 tar gz 文档可以不下载 vtk相关安装程序下载 h
  • MySQL基础高频面试题

    1 什么是索引 索引是一种用于快速查询和检索数据的数据结构 mysql中的索引结构有 B 树和Hash 索引的作用就相当于目录的作用 我们只需要先去目录里查找字的位置 然后直接翻到那一页就行了 这样查找就会非常快 2 索引的优缺点 优点 1
  • JavaWeb之HTML和CSS

    标签命令汇总 tr 行 td 单元格 b 加粗 font 字体标签 br 换行 a 超链接标签 ul 无序标签列表 ol 有序标签列表 li list ul 无序标签列表 href 设置链接地址 一 概述 1 B S软件结构 JavaSE中
  • 欧拉习题40

    题目如下 An irrational decimal fraction is created by concatenating the positive integers 0 12345678910111213141516171819202
  • CVPR-2022- MixFormer: End-to-End Tracking with Iterative Mixed Attention 阅读笔记

    目录 端到端的MixFormer跟踪整体框架 Mixed attention module MAM 基于角的定位头 基于查询的定位头 分数预测模块 SPM 论文地址 https arxiv org abs 2203 11082 代码地址 h
  • Java对象的序列化和反序列化实践

    当两个进程在进行远程通信时 彼此可以发送各种类型的数据 无论是何种类型的数据 都会以二进制序列的形式在网络上传送 发送方需要把这个Java对象转换为字节序列 才能在网络上传送 接收方则需要把字节序列再恢复为Java对象 把Java对象转换为
  • OrCAD打开工程报错-ERROR(ORCAP-1653)

    OrCAD打开工程报错 ERROR ORCAP 1653 OrCAD打开工程报错 ERROR ORCAP 1653 1 简要介绍 2 报错原因 3 解决方法 1 简要介绍 长期使用 OrCAD 以来都比较顺手 不知什么时候开始打开某些原理图
  • 解决hikari连接池一段时间不操作断开连接的问题

    起因 在自己项目中隔一段时间不操作数据库就会报错导致数据库连不上 报错信息 报错信息显示30207ms 差不多是30s 主要原因是因为我是用的SpringBoot版本使用的连接池是hikari 由其中一个属性connectionTimeou
  • Endnote 与word关联

    适用于endnotex7 endnotex8 endnotex9和office2019 office2021 第一步 打开Word 选择 选项 单击转到下一页 第二步 选择 加载项 COM加载项 转到 进入下一页 第三步 添加 可用加载项
  • python中.find函数的使用方法及实例_Python

    re findall findall string pos endpos 在字符串中找到正则表达式所匹配的所有子串 并返回一个列表 如果没有找到匹配的 则返回空列表 string 待匹配的字符串 pos 可选参数 指定字符串的起始位置 默认
  • [从零开始学DeepFaceLab-7]: 使用-命令行八大操作步骤-第4步:从目标图片中提取所需图片

    目录 总体流程 步骤4 从源片中提取脸部图片 4 1 命令 4 data src faceset extract MANUAL bat 不推荐使用
  • ElementUI浅尝辄止25:MessageBox 弹框

    模拟系统的消息提示框而实现的一套模态对话框组件 用于消息提示 确认消息和提交内容 从场景上说 MessageBox 的作用是美化系统自带的 alert confirm 和 prompt 因此适合展示较为简单的内容 如果需要弹出较为复杂的内容
  • 清华大学开源软件镜像站网址

    清华大学 TUNA 协会原名清华大学学生网管会 注册名清华大学学生网络与开源软件协会 是由清华大学网络技术和开源软件爱好者 技术宅组成的团体 现阶段向校内外提供开源软件镜像等服务 清华大学 TUNA 协会清华大学 TUNA 协会原名清华大学
  • win7安装了vc++6.0打开已保存文件项目就会崩溃

    我用win7安装了vc 6 0的英文完整版 绿色中文版 发现当运行程序时 要打开已保存文件项目就会崩溃 系统对话筐就说 Microsoft R Developer Studio已停止工作 选择调试或者关闭 office 2010 与vc 6
  • C++ 中只能在堆或栈上创建的对象

    1 只能在堆上创建的对象 1 把析构函数声明为private 2 定义一个destroy 函数 用这个函数来delete对象 void destroy delete this 2 只能在栈上创建的对象 1 覆盖operator new 和
  • 区块链数据不可篡改的详细解释

    区块链数据不可篡改的详细解释 背景介绍 本人新人一枚 学习区块链的过程中 在网上看到了很多讨论区块链区块数据不可篡改的文章 以比特币为例哈 主要存在2种解释 解释1 由于哈希指针的存在 假设存在某节点修改的了当前区块数据 带来的后果就是其后
  • 力扣 --- 45. 跳跃游戏II

    45 跳跃游戏II 2020 05 04 22 58 题目描述 给定一个非负整数数组 你最初位于数组的第一个位置 数组中的每个元素代表你在该位置可以跳跃的最大长度 你的目标是使用最少的跳跃次数到达数组的最后一次位置 示例 输入 2 3 1
  • vue组件(个人学习笔记三)

    目录 友情提醒 第一章 vue的组件 1 1 什么是SPA应用 1 2 vue的组件简介 1 3 vue工程中的main js文件 第二章 Vue组件的使用 2 1 一般组件的自定义 2 2 注册组件 全局注册和局部注册 2 2 1 全局注
  • phpstorm 调试_PhpStorm中的多用户调试

    phpstorm 调试 by Ray Naldo 雷 纳尔多 Ray Naldo PhpStorm中的多用户调试 Multi User Debugging in PhpStorm 使用Xdebug和DBGp代理 Using Xdebug a