elastic / elastic/apm-agent-php
Document limitation of upgrading PHP after agent is installed
- Dominant language
- PHP
- Stars
- 268
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
There is an issue that comes when PHP is upgraded after the agent is installed. It causes PHP to print error messages similar to the following
```
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/elastic/apm-agent-php/extensions/elastic_apm-20180731.so' (tried: /opt/elastic/apm-agent-php/extensions/elastic_apm-20180731.so (/opt/elastic/apm-agent-php/extensions/elastic_apm-20180731.so: undefined symbol: php_sprintf), /usr/lib64/php/modules//opt/elastic/apm-agent-php/extensions/elastic_apm-20180731.so.so (/usr/lib64/php/modules//opt/elastic/apm-agent-php/extensions/elastic_apm-20180731.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.28 (cli) (built: Feb 15 2022 13:23:10) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies**_
```
The root cause is the PHP agent's extension .so file is per PHP version so when PHP gets upgraded but PHP agent's .ini file still points to the same .so file which is now incompatible with the new PHP version.
It seems the simplest workaround recommendation is to just uninstall and install the agent again (which will automatically select correct .so file)
Contributor guide
Assessment
This issue has not been assessed yet.