Skip to content

Commit

Permalink
Documented open_basedir limitation and logging if boostrapper path do…
Browse files Browse the repository at this point in the history
…esn't comply that limitation (#1044)

* Documented open_basedir limitation and logging if boostrapper path doesn't comply that limitation (#909)
  • Loading branch information
intuibase authored Aug 30, 2023
1 parent 2b575ac commit c8bd1ab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
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
----

0 comments on commit c8bd1ab

Please sign in to comment.