apache2 - 在多用户环境中使用 XDebug
问题描述
我正在与其他人共享本地服务器上进行开发。该服务器有一个 Apache/PHP 实例,但它有多个“可用站点”(VirtualHost)供不同的人使用。
我想让 XDebug 工作,这样我们每个人都可以独立使用它。问题是,如果我们启用 XDebug,例如,我的 IDE 连接到服务器并且我设置了一个断点,那么如果其他人正在浏览该页面,它就会停止,即使它在他/她自己的 VirtualHost 中。
关于如何正确设置的任何提示?
编辑:
忘了提到网络服务器是在 Docker 中运行的。这是 XDebug 的当前配置:
# automatically start debugger on every request
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_port=9000
# send all debug requests to 127.0.0.1
xdebug.remote_connect_back=0
xdebug.remote_host=host.docker.internal
#log all xdebug requests to see is it working correctly
xdebug.remote_log=/var/log/debug.log
谢谢。
解决方案
这根本不应该发生,除非您已xdebug.remote_autostart
打开并进行了硬编码xdebug.remote_host
(而不是使用xdebug.remote_connect_back
)。您真的不想xdebug.remote_host
在多用户环境中硬编码。
调试会话仅在检测到 XDEBUG_SESSION_START(这是浏览器扩展将设置的内容,或者将其添加到 GET/POST 参数时)以及继续请求时才初始化。
也没有这样的概念:
我的 IDE 已连接到服务器
在每次请求时,Xdebug(如果设置为使用 cookie 触发)将连接到IDE。它使用xdebug.remote_host
设置或推断的 IP 地址(如果xdebug.remote_connect_back
已启用连接到. 请求结束,该连接被切断。您可以使用xdebug.remote_log=/tmp/xdebug.log
创建一个日志文件,该文件将指示何时建立连接,以及它们是否有效。
推荐阅读
- javascript - 什么是用一串数字(包括空格)创建数组的方法?
- mysql - mySQL 数据库中的截断密码哈希
- ksqldb - ksqldb REST API - 如何从带有推送查询的表中接收墓碑值?
- python - Python按多个级别上的多个值对dict进行排序
- eiffel - 结果附加或异常
- angular - 角管;对象数组和对象包括数组
- powershell - 将数据从文本文件转换为 html
- python - 创建大小取决于数据框列中的最大值的矩阵时找不到 TypeError 的来源
- build - 是否可以在 Next.js 中完全禁用 SSR/SSG?
- shell - 找出一个特定的字符并相应地执行搜索?