zend_extension="/usr/lib/php/20190902/xdebug.so (that has an extra ").

In any case, it is very likely that there is either another xdebug.mode line somewhere, or a different INI file is being used. Try to see what the output of xdebug_info() tells you — it also mentions which INI files have been read.

Answer from Derick on Stack Overflow
🌐
Xdebug
xdebug.org › docs › all_settings
Xdebug: Documentation » All settings
You can also set Xdebug's mode by setting the XDEBUG_MODE environment variable on the command-line; this will take precedence over the xdebug.mode setting, but will not change the value of the xdebug.mode setting.
🌐
Xdebug
xdebug.org › docs › step_debug
Xdebug: Documentation » Step Debugging
You can also set Xdebug's mode by setting the XDEBUG_MODE environment variable on the command-line; this will take precedence over the xdebug.mode setting, but will not change the value of the xdebug.mode setting.
Discussions

Docker PHP with Xdebug 3 env XDEBUG_MODE doesn't work - Stack Overflow
I’m trying to config Xdebug 3 in PHP container, and set XDEBUG_MODE env variable to off according with documentation https://xdebug.org/docs/all_settings#mode but xdebug_info() shows that mode= More on stackoverflow.com
🌐 stackoverflow.com
Support XDEBUG_MODE environment variable
Q A PHPUnit version 9.4.3 PHP version 7.4.11 Installation Method Composer Summary PHPUnit only understands Xdebug modes set in php.ini when checking for coverage availability. When running: $ XDEBU... More on github.com
🌐 github.com
8
November 26, 2020
Set xdebug.mode to develop by default - Completed Feature Requests - Local Community
Hi, I think xdebug.mode previously was set to ‘develop’. Now it’s set to ‘debug’ by default, which doesn’t wrap the output in pre-tags. With the develop-setting this made output from PHP functions like var_dump() way more readable for developers. Longer, but way more readable. More on community.localwp.com
🌐 community.localwp.com
0
October 27, 2022
php - Xdebug 3 config file - Stack Overflow
I need help with a working step debugging Xdebug 3 config. I am running Xdebug 3.0.1 on Ubuntu server 20.04 with nginx, installed on an Oracle VirtualBox. My IDE is PhpStorm. Everything is working ... More on stackoverflow.com
🌐 stackoverflow.com
Top answer
1 of 2
3

zend_extension="/usr/lib/php/20190902/xdebug.so (that has an extra ").

In any case, it is very likely that there is either another xdebug.mode line somewhere, or a different INI file is being used. Try to see what the output of xdebug_info() tells you — it also mentions which INI files have been read.

2 of 2
-2

I'm here to help anyone with Xdebug on a Windows system and PHP 7.4 installed. Can try to set the php.ini as shown below. Can see my xdebug extension is called php_xdebug.dll inside this folder C:\xampp\php\ext\

xdebug.remote_autostart = 0
xdebug.mode = debug
xdebug.start_with_request = yes
zend_extension = C:\xampp\php\ext\php_xdebug.dll
xdebug.stopOnEntry = true
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.output_dir ="c:\xampp\tmp"
xdebug.show_local_vars=0
xdebug.remote_handler = "dbgp"
xdebug.client_host = "127.0.0.1"
xdebug.log = "C:\xampp\tmp\xdebug.txt"
xdebug.client_port = 9000
xdebug.remote_cookie_expire_time = 36000

*Extras for the visual studio code user. Make sure the port inside the configuration is the same as the one that you set.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 0,
            "runtimeArgs": [
                "-dxdebug.start_with_request=yes"
            ],
            "env": {
                "XDEBUG_MODE": "debug,develop",
                "XDEBUG_CONFIG": "client_port=${port}"
            }
        },
        {
            "name": "Launch Built-in web server",
            "type": "php",
            "request": "launch",
            "runtimeArgs": [
                "-dxdebug.mode=debug",
                "-dxdebug.start_with_request=yes",
                "-S",
                "localhost:0"
            ],
            "program": "",
            "cwd": "${workspaceRoot}",
            "port": 9000,
            "serverReadyAction": {
                "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
                "uriFormat": "http://localhost:%s",
                "action": "openExternally"
            }
        }
    ]
}
🌐
JetBrains
jetbrains.com › help › phpstorm › configuring-xdebug.html
Configure Xdebug | PhpStorm Documentation
Xdebug 3 uses the xdebug.start_upon_error setting, which has to be set to yes. The mode is available both for debugging command-line scripts and for web server debugging.
Top answer
1 of 2
6

It actually works. I mean: the actual behaviour / final result.

Despite the fact that it shows xdebug.mode => develop the actual features are ALL turned OFF:

Feature => Enabled/Disabled
Development Aids => ✘ disabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger => ✘ disabled
Tracing => ✘ disabled

I've tested it locally on a Windows 10 .. and I see the same:

php.ini has

xdebug.mode = debug

Without XDEBUG_MODE override cmd shows that the debugger is enabled as it should:

Feature => Enabled/Disabled
Development Aids => ✘ disabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger =>  enabled
Tracing => ✘ disabled
...
xdebug.mode => debug => debug

With XDEBUG_MODE override:

C:\Users\Andriy
$ SET XDEBUG_MODE=off

C:\Users\Andriy
$ php -r "xdebug_info();"

...
Feature => Enabled/Disabled
Development Aids => ✘ disabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger => ✘ disabled
Tracing => ✘ disabled
...
xdebug.mode => debug => debug

If I run this command (passing additional Xdebug config param that tells to start debugging straight away):

php -dxdebug.start_with_request=yes -r "xdebug_info();"

then WITHOUT the override it will try to establish the debug connection and WITH override it will not try to do that. That confirms that the override works (at very least here in my environment).

2 of 2
1

The XDEBUG_MODE environment defined in docker-compose definition is overriding the default value from Dockerfile.

Your way only works if you invoke docker-compose with the --env-file (> docker-compose --env-file=xdebug.env ...)

I guess what you want is to inherit a XDEBUG_MODE you are defining inline or is already present in the terminal/shell environment. In that case you just need to declare the var without any value

services:
  php:
    environment:
      XDEBUG_MODE

and call docker-compose similar to > XDEBUG_MODE=Off docker-compose

Find elsewhere
🌐
Xdebug
xdebug.org › docs › all_functions
Xdebug: Documentation » All functions
The function returns an array of all the enabled modes, whether through xdebug.mode or the XDEBUG_MODE environment variable.
🌐
GitHub
github.com › sebastianbergmann › php-code-coverage › issues › 834
Support XDEBUG_MODE environment variable · Issue #834 · sebastianbergmann/php-code-coverage
November 26, 2020 - It is not recognised that the mode is set. ... Any repository with phpunit available in vendor/bin/phpunit. Run: XDEBUG_MODE=coverage php -n -dzend_extension=xdebug vendor/bin/phpunit --coverage-text
Author   derickr
🌐
Local
community.localwp.com › resolved › completed feature requests
Set xdebug.mode to develop by default - Completed Feature Requests - Local Community
October 27, 2022 - Hi, I think xdebug.mode previously was set to ‘develop’. Now it’s set to ‘debug’ by default, which doesn’t wrap the output in pre-tags. With the develop-setting this made output from PHP functions like var_dump() way more readable for developers. Longer, but way more readable.
🌐
Lando 3
docs.lando.dev › guides › lando-phpstorm.html
Lando + PhpStorm + Xdebug | Lando 3
March 11, 2025 - config: # Set Xdebug off by default. We use the tooling below to turn it on as needed. xdebug: false services: appserver: overrides: environment: XDEBUG_MODE: 'debug,develop' tooling: xdebug-on: service: appserver description: Enable Xdebug.
🌐
M
m.academy › lessons › configure-modes-xdebug
Configure modes in Xdebug - Developer Lesson
You can make Xdebug available for debugging by setting this value to “debug”: ... The most common mode is debug, which enables step debugging.
Published   January 6, 2025
🌐
Xdebug
xdebug.org › docs-profiling.php
Xdebug: Documentation » Profiling
You can also set Xdebug's mode by setting the XDEBUG_MODE environment variable on the command-line; this will take precedence over the xdebug.mode setting, but will not change the value of the xdebug.mode setting.
🌐
Xdebug
xdebug.org › docs › upgrade_guide
Xdebug: Documentation » Upgrading from Xdebug 2 to 3
Unlike Xdebug 2, where there was an enabling setting for each feature, with Xdebug 3 you put Xdebug into a specific mode, which can be configured with the xdebug.mode setting.
🌐
Xdebug
xdebug.org › docs › errors
Xdebug: Documentation » Description of errors
The XDEBUG_MODE environment variable can be used to override the mode as set with xdebug.mode.
🌐
PHP.Watch
php.watch › articles › xdebug2-vs-3-benchmark
Xdebug 2 vs Xdebug 3 Performance Comparison • PHP.Watch
November 17, 2020 - Note that xdebug.mode configuration can only be set in an INI file, or with XDEBUG_MODE=develop environment variable, but it now simplifies temporarily enabling individual Xdebug features. When xdebug.mode=off is set, there is close to zero performance impact. Thanks to Derick Rethans for his awesome work Xdebug project for over 18 years to date.
🌐
Medium
rohit-shirke.medium.com › do-you-xdebug-your-php-code-da9f25e2298d
Do you Xdebug your PHP code?. Debugging the code is an integral part… | by Rohit Shirke | Medium
August 7, 2021 - [XDebug]zend_extension = C:\xampp\php\ext\php_xdebug-2.9.6-7.3-vc15-x86_64.dll#xdebug 2xdebug.remote_enable=1 xdebug.default_enable=0 xdebug.profiler_enable=0 xdebug.auto_trace=0 xdebug.coverage_enable=0 xdebug.remote_autostart = 1 xdebug.remote_port=9000 xdebug.remote_host=127.0.0.1 xdebug.remote_connect_pack=1 xdebug.idekey=XDEBUG_ECLIPSE xdebug.var_display_max_depth = 10#xdebug 3 xdebug.mode=debug xdebug.start_with_request = yes#to use default_enable set xdebug.mode=develop #to use profiler_enable set xdebug.mode=profile #to use auto_traceset xdebug.mode=trace with xdebug.start_with_request=yes #to use coverage_enable set xdebug.mode=coveragexdebug.client_port = 9003 #9003 is default port now!