diff --git a/features/dtrace.xml b/features/dtrace.xml index 2b92e15b6ab2..c221ac62248f 100644 --- a/features/dtrace.xml +++ b/features/dtrace.xml @@ -546,6 +546,194 @@ probe process("sapi/cli/php").provider("php").mark("request__startup") { + + + + + + + Using bpftrace with PHP DTrace Static Probes + + On Linux distributions with a kernel that supports eBPF, the + bpftrace utility can attach to PHP's DTrace USDT probes directly, + without requiring SystemTap. + + + Installing bpftrace + + Install bpftrace using the distribution's package manager. For + example, on Oracle Linux, RHEL, or Fedora: + + + + + + Or, on Debian or Ubuntu: + + + + + + + + The examples below assume the target PHP binary is installed at + /usr/bin/php. + + + The same USDT probes are also exposed by other SAPIs built from the same source tree, so the + probe target may instead be the Apache module + (libphp.so) or the FastCGI Process Manager + binary (php-fpm); substitute the appropriate + path or attach by PID with -p as needed. + + + Make sure the target binary is built with DTrace and that the environment is configured properly. + See Configuring PHP for DTrace Static Probes for details. + + + The static probes in PHP can be listed using + bpftrace: + + + + + + + + + This outputs: + + + + + + + + + + <filename>all_probes.bt</filename> for tracing all PHP Static Probes with bpftrace + + + + + + + + The above script will trace all core PHP static probe points + throughout the duration of a running PHP script. bpftrace requires + root privileges: + + + + + + + + + To trace an already-running PHP process (for instance, a + php-fpm worker or an Apache process loading + libphp.so), attach by PID: + + +