elastic / elastic/apm-agent-php
[PHP-FPM] apm-agent-php is ignoring all elastic_apm directives inside php-fpm pool configuration
- Dominant language
- PHP
- Stars
- 268
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
OS: Centos 7.9
PHP: 7.4.28
In the php-fpm pool configuration (/etc/php-fpm.d/mypoll.conf) I've added these directives:
```
php_admin_flag[elastic_apm.enabled] = true
php_admin_value[elastic_apm.environment] = "test"
php_admin_value[elastic_apm.log_level] = "INFO"
php_admin_value[elastic_apm.log_level_stderr] = "INFO"
php_admin_value[elastic_apm.server_timeout] = "30s"
php_admin_value[elastic_apm.server_url] = "https://:"
php_admin_value[elastic_apm.service_name] = "dev-webfarm-php-comm-portali"
php_admin_value[elastic_apm.transaction_max_spans] = 500
php_admin_value[elastic_apm.transaction_sample_rate] = 1.0
php_admin_flag[elastic_apm.verify_server_cert] = false
```
In my /etc/php.d/99-elastic-apm-custom.ini link (-> /opt/elastic/apm-agent-php/etc/99-elastic-apm-custom.ini) I've set these two lines:
```
[elastic]
elastic_apm.enabled = false
```
What I expect is that the above directive `php_admin_flag[elastic_apm.enabled] = true` in mypoll.conf file overrides the directive `elastic_apm.enabled = false` in 99-elastic-apm-custom.ini file and indeed it does but in practice is ignored by the agent as well as all the other directives in mypool.conf file.
As a result the apm-agent-fpm remains disabled and doesn't work. Even if the `phpinfo();` function returns all the variables well defined and the `elastic_apm.enabled` overridden with a `true` value.
The workaround is as simple as explanatory: renaming (or deleting) the agent custom ini file (es. `/opt/elastic/apm-agent-php/etc/99-elastic-apm-custom.NOT`) the pool configuration works! Because all `elastic_apm` directives in /etc/php-fpm.d/mypoll.conf are taken into account
**Expected behavior**
I expect both directives inside /etc/php.d/99-elastic-apm-custom.ini and /etc/php-fpm.d/mypoll.conf files are merged with the priority of those inside pool configuration (mypoll.conf).
It deserves to check if this behavior is affecting also Apache Httpd per virtual host mod_php directives.
Contributor guide
Assessment
This issue has not been assessed yet.