MantisBT - Xdebug
View Issue Details
0001365XdebugFeature/Change requestpublic2016-11-18 11:572016-12-04 18:33
0001365: Allow remote_connect_back to be set through XDEBUG_CONFIG
XDEBUG_CONFIG is ignoring `remote_connect_back` setting, please look at reproduce steps.
$ php -i | grep remote_connect_back

xdebug.remote_connect_back => Off => Off

$ export XDEBUG_CONFIG="remote_connect_back=1"


$ php -i | grep remote_connect_back

xdebug.remote_connect_back => Off => Off
XDEBUG_CONFIG => remote_connect_back=1
_SERVER["XDEBUG_CONFIG"] => remote_connect_back=1
No tags attached.
Issue History
2016-11-18 11:57rusbik92New Issue
2016-11-20 22:32derickNote Added: 0003767
2016-11-20 22:32derickAssigned To => derick
2016-11-20 22:32derickStatusnew => feedback
2016-11-21 07:30rusbik92Note Added: 0003770
2016-11-21 07:30rusbik92Statusfeedback => assigned
2016-11-22 23:25derickNote Added: 0003773
2016-11-22 23:25derickStatusassigned => resolved
2016-11-22 23:25derickResolutionopen => won't fix
2016-11-24 14:28rusbik92Note Added: 0003791
2016-11-24 14:28rusbik92Statusresolved => feedback
2016-11-24 14:28rusbik92Resolutionwon't fix => reopened
2016-11-24 14:31rusbik92Note Edited: 0003791bug_revision_view_page.php?bugnote_id=3791#r319
2016-12-04 17:04derickNote Added: 0003920
2016-12-04 17:04derickStatusfeedback => closed
2016-12-04 17:04derickCategoryRemote Debugging => Feature/Change request
2016-12-04 17:04derickFixed in Version => 2.5.0RC2
2016-12-04 17:04derickSummaryremote_connect_back setting is ignored in XDEBUG_CONFIG => Allow remote_connect_back to be set through XDEBUG_CONFIG
2016-12-04 17:04derickSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=335#r335
2016-12-04 18:33derickFixed in Version2.5.0RC2 => 2.5.0

2016-11-20 22:32   
Only a few INI settings for Xdebug are supported through XDEBUG_CONFIG. remote_connect_back isn't one of them. What make you think (documentation, for example) that this was supported?
2016-11-21 07:30   
Well, documentation says:

When running the script from the command line you need to set an environment variable, like:
export XDEBUG_CONFIG="idekey=session_name"
php myscript.php
You can also configure the xdebug.remote_host, xdebug.remote_port, xdebug.remote_mode and xdebug.remote_handler in this same environment variable as long as you separate the values by a space:
export XDEBUG_CONFIG="idekey=session_name remote_host=localhost profiler_enable=1"
All settings that you can set through the XDEBUG_CONFIG setting can also be set with normal php.ini settings.

I thought, that if documentation says, that xdebug.remote_host, xdebug.remote_port, xdebug.remote_mode and xdebug.remote_handler can be set in XDEBUG_CONFIG, but also profiler_enable usage mentioned in example I can set something else in XDEBUG_CONFIG, for example remote_connect_back (that was extremely useful in my situation).

But why, for god sake, this parameter was not supported? I can understand, that whatever trace_options is not so important for that, but remote_connect_back should be there.
2016-11-22 23:25   

Xdebug has over 50 settings, and each of them would need to be hardcoded in
the xdebug_env_config function in xdebug.c to support this. As PHP already
allows configuration through passing -doption=value on the command line, there
must be a large advantage for the setting to be configurable through the
XDEBUG_CONFIG environment variable for me to want to add it there.

The original intention for allowing configuration settings to be made through
an environment variable was to allow IDEs to set up a known state to allow
for debugging. This got later extended to triggering profiling and tracing
as well. As xdebug.remote_connect_back puts the debugger in an *unstable*
state (as the IP address to connect to can change away from what the IDE
expects), this setting was not included.

2016-11-24 14:28   
(edited on: 2016-11-24 14:31)
Excuse me, but i have to reopen it to clarify, why this feature is important for my situation.
I have docker container with php+xdebug in it. Xdebug configured with remote_connect_back=1 in php.ini and when i start container on Linux machine all is working. But when i start it on Windows machine, there is a problem between Hyper-v virtual adapter and docker network, well, xdebug cannot refer to docker adapter's IP, because tcp port is not forwarded via Hyper-v. So the only way to make it work - is to somehow set xdebug remote_connect_back=0 and hardcode remote_host to host IP (developer just need to set env variable XDEBUG_CONFIG=, where - his machine's IP). Well, container can take env variable value from host machine and use it inside itself.
Yep, this is Windows specific issue and the main goal was to make windows developers (they are in minority) in our company to do some workaround instead of linux users (because we can make all users to set XDEBUG_CONFIG=192.168.0.x and it will work).

2016-12-04 17:04   
Makes sense. I've added it to 2.5.0RC2.