diff --git a/agent/native/ext/lifecycle.cpp b/agent/native/ext/lifecycle.cpp index 67707eb60..bb0429527 100644 --- a/agent/native/ext/lifecycle.cpp +++ b/agent/native/ext/lifecycle.cpp @@ -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: diff --git a/docs/setup.asciidoc b/docs/setup.asciidoc index 4f27101d1..72ccc48dd 100644 --- a/docs/setup.asciidoc +++ b/docs/setup.asciidoc @@ -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. diff --git a/docs/troubleshooting.asciidoc b/docs/troubleshooting.asciidoc index d93d0f58d..fc3ff7c8a 100644 --- a/docs/troubleshooting.asciidoc +++ b/docs/troubleshooting.asciidoc @@ -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 <>. Also see <>. + +=== 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 <> +---- +[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 +----