View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002174 | Xdebug | Profiling | public | 2023-04-12 12:34 | 2023-09-04 11:26 |
Reporter | Leon | Assigned To | derick | ||
Priority | low | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 3.2.1 | ||||
Target Version | 3.2dev | ||||
Summary | 0002174: start_with_request not settable via XDEBUG_CONFIG | ||||
Description | It appears that the 'start_with_request' setting cannot be set via XDEBUG_CONFIG. XDEBUG_MODE: debug,profile The 'client_host' and 'output_dir' settings are correctly used, but 'start_with_request' remains set to 'default'. See screenshots, you can see 'output_dir' is correctly set via XDEBUG_CONFIG, but 'start_with_request' is not. | ||||
Steps To Reproduce |
| ||||
Additional Information | PHP 8.1.9 | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Operating System | |||||
PHP Version | 8.1.5-8.1.9 | ||||
|
This is in line with the documentation. Only some settings are settable through XDEBUG_CONFIG, as described at https://xdebug.org/docs/all_settings#XDEBUG_CONFIG. The https://xdebug.org/docs/all_settings#start_with_request documentation does not state it can be set there. What is your specific use case here? Ideally, PHP itself would have functionality to do this, so that I don't have to hack it for Xdebug... |
|
Oh I must have missed that, apologies!
The use-case here is that we run multiple (identical) Docker containers of a PHP application. For validation and testing purposes we want the containers to use identical configuration (ini files, extensions, etc). For development we want to enable debugging (in various modes and configurations), so we do that by setting XDEBUG_MODE and XDEBUG_CONFIG environment variables for the various containers. It would be really useful (for us at least) if we could set the trigger mode via an environment variable, so that we do not have to build a dedicated container just to set that one configuration. |
|
I think you can already do this by using environment variables in PHP.ini files. This isn't a feature that lots of people know about, but you can set the following in
Would that work in your case too? |
|
Hi Derick, thanks for the reply! I never did realize that you can use environment variables in .ini files. Yes, I think this would work for my use-case, but only if the absence of the environment variable wouldn't cause any problems. What happens if environment variable ''PHP_XDEBUG_START_WITH_REQUEST'' is not defined in your example? ''${PHP_XDEBUG_START_WITH_REQUEST}'' would yield an empty value, so will this cause xdebug to use the 'default' value then? In the end, I think it would be better if PHP would allow setting defaults, such as this: ''xdebug.start_with_request = ${PHP_XDEBUG_START_WITH_REQUEST:default}'' But of course that is an PHP issue, not an xdebug issue. |
|
It looks like if it is empty (or absent) it is interpreted as "no":
Let me see if I can "fix" PHP here... |
|
Looks like there was already a PR to implement this in PHP: https://github.com/php/php-src/pull/11351 — I'll chase up on this one, as it's better than the PR that I spent time on :-/. |
|
As the linked PHP PR has now been merged, I am closing this ticket. It will be in PHP 8.3! |
|
Thank you derick! Your suggested solution has been working great for us. And the default config values PR for PHP 8.3 would make it even better :-) Thank you for the great work on XDebug! |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-04-12 12:34 | Leon | New Issue | |
2023-04-12 12:34 | Leon | File Added: 2023-04-12_14:23:58.png | |
2023-04-12 12:34 | Leon | File Added: 2023-04-12_14:31:07.png | |
2023-05-24 16:09 | derick | Severity | minor => feature |
2023-05-24 16:09 | derick | Status | new => feedback |
2023-05-24 16:09 | derick | Target Version | => 3.2dev |
2023-05-24 16:09 | derick | Note Added: 0006562 | |
2023-05-24 16:19 | Leon | Note Added: 0006564 | |
2023-05-24 16:19 | Leon | Status | feedback => new |
2023-07-04 16:18 | derick | Assigned To | => derick |
2023-07-04 16:18 | derick | Status | new => feedback |
2023-07-04 16:18 | derick | Note Added: 0006578 | |
2023-07-05 09:51 | Leon | Note Added: 0006584 | |
2023-07-05 09:51 | Leon | Status | feedback => assigned |
2023-07-10 10:34 | derick | Note Added: 0006586 | |
2023-07-10 15:34 | derick | Note Added: 0006587 | |
2023-09-04 11:06 | derick | Status | assigned => resolved |
2023-09-04 11:06 | derick | Resolution | open => no change required |
2023-09-04 11:06 | derick | Note Added: 0006647 | |
2023-09-04 11:26 | Leon | Note Added: 0006648 |