elastic / elastic/apm-agent-php

XDebug warning even when APM is disabled

Open
#1,279 1 comment 1 reaction 0 assignees View on GitHub
agent-php bug
Dominant language
PHP
Stars
268
Forks
86
PR merge metrics
No merged PRs in 30d

Description

In https://github.com/elastic/apm-agent-php/pull/1257 you introduced a log warning when xdebug is enabled.

But the warning appears even when elastic APM is disabled

```shell
$ ELASTIC_APM_ENABLED=false php -r 'var_export(ini_get("ELASTIC_APM_ENABLED"));'
[Elastic APM PHP Tracer] 2025-01-27 16:26:38.484087+00:00 [PID: 205] [TID: 205] [WARNING] [Lifecycle] [lifecycle.cpp:421] [elasticApmRequestInit] Xdebug is loaded, which is not supported by the Elastic APM Agent. This may lead to stability or memory issues
false
```

I'm using a docker image with xdebug and elastic APM installed. xdebug is enabled in dev but APM disabled. APM is only enabled on prod. So I'm seeing always this log.

I think the code should also check if [xdebug.mode](https://xdebug.org/docs/all_settings#mode) is off (or XDEBUG_MODE=off), not only if xdebug extension is loaded.

```shell
$ XDEBUG_MODE=off php -r 'var_export(getenv("XDEBUG_MODE"));'
[Elastic APM PHP Tracer] 2025-02-21 10:57:14.251539+00:00 [PID: 139] [TID: 139] [WARNING] [Lifecycle] [lifecycle.cpp:421] [elasticApmRequestInit] Xdebug is loaded, which is not supported by the Elastic APM Agent. This may lead to stability or memory issues
'off'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.