Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented open_basedir limitation and logging if boostrapper path doesn't comply that limitation #1044

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions agent/native/ext/lifecycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ void elasticApmModuleInit( int moduleType, int moduleNumber )

elasticapm::php::Hooking::getInstance().replaceHooks();

if (php_check_open_basedir_ex(config->bootstrapPhpPartFile, false) != 0) {
ELASTIC_APM_LOG_WARNING( "Elastic Agent bootstrap file (%s) is located outside of paths allowed by open_basedir ini setting. Read more details here https://www.elastic.co/guide/en/apm/agent/php/current/setup.html#limitations", config->bootstrapPhpPartFile);
}

resultCode = resultSuccess;
finally:

Expand Down
4 changes: 4 additions & 0 deletions docs/setup.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,7 @@ and the downloaded source files.
So if you would like to build `elastic_apm-*.so` on one machine and
then deploy it on a different machine, you will need to copy both
the built `elastic_apm-*.so` and the downloaded source files.

=== Limitations
[[limitations]]
Please be aware that if the https://www.php.net/manual/en/ini.core.php#ini.open-basedir[open_basedir] option is configured in your php.ini, the installation directory of the agent (by default /opt/elastic/apm-agent-php) must be located within a path included in the https://www.php.net/manual/en/ini.core.php#ini.open-basedir[open_basedir] configuration. Otherwise, the agent will not be loaded correctly.
10 changes: 10 additions & 0 deletions docs/troubleshooting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,13 @@ to enable verbose log for the agent's communication with Elastic APM Server.
The log is written under `INFO` level - see <<configure-logging>>.

Also see <<dev-internal-config-disclaimer>>.

=== Agent is not instrumenting code
[source,bash]

==== open_basedir issue

If you see a similar entry in the agent log, this indicates an incorrect open_basedir configuration. Please read the details in the <<limitations, limitations>>
----
[Elastic APM PHP Tracer] 2023-08-23 14:38:12.223397+02:00 [PID: 268995] [TID: 268995] [WARNING] [Lifecycle] [lifecycle.cpp:558] [elasticApmModuleInit] Elastic Agent bootstrap file (/home/paplo/sources/apm-agent-php/agent/php/bootstrap_php_part.php) is located outside of paths allowed by open_basedir ini setting. Read more details here https://www.elastic.co/guide/en/apm/agent/php/current/setup.html
----