Differences between revisions 2 and 3
Revision 2 as of 2018-10-05 15:39:34
Size: 3186
Editor: WilliamCohen
Comment: minor edits
Revision 3 as of 2018-10-05 15:40:35
Size: 3185
Editor: WilliamCohen
Comment: minor edits
Deletions are marked like this. Additions are marked like this.
Line 36: Line 36:
== Using !PHP User-Space Markers == == Using PHP User-Space Markers ==

PHP User-Space Markers

Since PHP-5.5.x released in June 2013 PHP has included support for SystemTap user-space markers. The SystemTap user-space markers are enabled in Fedora 28 and RHEL 7 and allow SystemTap to probe various aspects of PHP operation such as handling exceptions and executing functions. Below is the SystemTap command and the resulting output listing the PHP user-space probes points:

$ stap -L 'process("/usr/bin/php*").provider("php").mark("*")' 
process("/usr/bin/php").provider("php").mark("compile__file__entry") $arg1:long $arg2:long
process("/usr/bin/php").provider("php").mark("compile__file__return") $arg1:long $arg2:long
process("/usr/bin/php").provider("php").mark("error") $arg1:long $arg2:long $arg3:long
process("/usr/bin/php").provider("php").mark("exception__caught") $arg1:long
process("/usr/bin/php").provider("php").mark("exception__thrown") $arg1:long
process("/usr/bin/php").provider("php").mark("execute__entry") $arg1:long $arg2:long
process("/usr/bin/php").provider("php").mark("execute__return") $arg1:long $arg2:long
process("/usr/bin/php").provider("php").mark("function__entry") $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
process("/usr/bin/php").provider("php").mark("function__return") $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
process("/usr/bin/php").provider("php").mark("request__shutdown") $arg1:long $arg2:long $arg3:long
process("/usr/bin/php").provider("php").mark("request__startup") $arg1:long $arg2:long $arg3:long
process("/usr/bin/php-cgi").provider("php").mark("compile__file__entry") $arg1:long $arg2:long
process("/usr/bin/php-cgi").provider("php").mark("compile__file__return") $arg1:long $arg2:long
process("/usr/bin/php-cgi").provider("php").mark("error") $arg1:long $arg2:long $arg3:long
process("/usr/bin/php-cgi").provider("php").mark("exception__caught") $arg1:long
process("/usr/bin/php-cgi").provider("php").mark("exception__thrown") $arg1:long
process("/usr/bin/php-cgi").provider("php").mark("execute__entry") $arg1:long $arg2:long
process("/usr/bin/php-cgi").provider("php").mark("execute__return") $arg1:long $arg2:long
process("/usr/bin/php-cgi").provider("php").mark("function__entry") $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
process("/usr/bin/php-cgi").provider("php").mark("function__return") $arg1:long $arg2:long $arg3:long $arg4:long $arg5:long
process("/usr/bin/php-cgi").provider("php").mark("request__shutdown") $arg1:long $arg2:long $arg3:long
process("/usr/bin/php-cgi").provider("php").mark("request__startup") $arg1:long $arg2:long $arg3:long

Using PHP User-Space Markers

To use the SystemTap user-space markers on a Fedora you will need:

  • RPMs:
    • systemtap
    • php-cli
  • Membership to the stapdev group (or root access)

Examples Scripts for PHP Probing

Short example scripts:

References

None: PHPMarkers (last edited 2018-10-05 15:40:35 by WilliamCohen)