我正在尝试 Xdebug 3
在 PHP 容器中进行配置,并将 XDEBUG_MODE
env 变量设置为off
符合文档 https://xdebug.org/docs/all_settings#mode但xdebug_info()
显示mode=develop
. 怎么修?
Dockerfile:
FROM php:7.4.11-fpm
…
ENV XDEBUG_MODE=off
ENV XDEBUG_CONFIG=""
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug \
...
码头工人-compose.yml:
services:
php:
build:
dockerfile: ${PWD}/.devcontainer/Dockerfile
image: php-fpm
environment:
XDEBUG_MODE: ${XDEBUG_MODE} // off
XDEBUG_CONFIG: ${XDEBUG_CONFIG}
xdebug 信息:
php -r 'xdebug_info();'
Version => 3.0.0
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
Feature => Enabled/Disabled
Development Aids => ✘ disabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger => ✘ disabled
Tracing => ✘ disabled
PHP
Build Configuration
Version => 7.4.11
Debug Build => no
Thread Safety => disabled
Settings
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-amqp.ini,
/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini,
Directive => Local Value => Master Value
xdebug.mode => develop => develop
更新:
我的案例:我使用 VSCode 来调试我的应用程序,所以只有在 Xdebug 侦听处于活动状态时才需要打开 Xdebug 模块。更好的方法是使用 env XDEBUG_CONFIG 和 XDEBUG_MODE,因为它不需要更改 ini 文件。