Skip to content

XDebug warning even when APM is disabled #1279

@JoniJnm

Description

@JoniJnm

In #1257 you introduced a log warning when xdebug is enabled.

But the warning appears even when elastic APM is disabled

$ 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 is off (or XDEBUG_MODE=off), not only if xdebug extension is loaded.

$ 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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions