Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Chris Jones:
Tracing Silex from PHP to the OS with DTrace
Nov 06, 2013 @ 18:31:23

Continuing on with his look at using DTrace in with PHP, Chris Jones has a new post in the series showing how to add traces to Silex-based applications, including sample output.

In this blog post I show the full stack tracing of Brendan Gregg's php_syscolors.d script in the DTrace Toolkit. The Toolkit contains a dozen very useful PHP DTrace scripts and many more scripts for other languages and the OS. For this example, I'll trace the PHP micro framework Silex, which was the topic of the second of two talks by Dustin Whittle at a recent SF PHP Meetup. His slides are at Silex: From Micro to Full Stack.

He includes a brief guide to getting the DTrace support up and running based on instructions in a previous post based on some pre-build Oracle linux packages. He links to the latest DTrace Toolkit and the downloads page to get the latest version of Silex. He sets up a super-basic Silex application (one route, "hello") and shows how to run the DTrace against it. His sample output shows both the PHP files being called and the functions/methods called inside them resulting in an output over a thousand lines long.

tagged: silex dtrace trace execution oracle package toolkit tutorial

Link: https://blogs.oracle.com/opal/entry/tracing_silex_from_php_to

Chris Jones:
DTracing a PHPUnit Test: Looking at Functional Programming
Nov 04, 2013 @ 17:04:20

On his Oracle blog Chris Jones has shared more details about using DTrace for dynamic tracing of the execution of your application. In this new post he looks more specifically at using it to trace through a PHPUnit test for a functional programming example.

I was reading the article Functional Programming in PHP by Patkos Csaba and wondering how efficient this type of programming is. I thought this would be a good time to fire up DTrace and see what is going on. Since DTrace is "always available" even in production machines (once PHP is compiled with --enable-dtrace), this was easy to do.

Using the code provided from the other post he sets things up to run some sample tests via PHPUnit. He makes a simple DTrace D script to configure a tracer to watch for "function entry" and "function exit" during execution, outputting the function tree each time when the given function is found (via a parameter). He includes both the command to run the test with the trace and an example of the output result.

tagged: dtrace linux phpunit unittest functional programming example

Link: https://blogs.oracle.com/opal/entry/dtracing_a_phpunit_test_looking

Chris Jones:
DTrace PHP Using Oracle Linux 'playground' Pre-Built Packages
Oct 03, 2013 @ 14:12:07

Related to some of his other posts about using DTrace with PHP, Chris Jones has a new post about using pre-built packages to make using it even easier.

We've released DTrace-enabled PHP 5.5.4 RPMs to make testing DTrace on Oracle Linux easier. As a result, the manual PHP install steps listed in Using PHP DTrace on Oracle Linux can be skipped. There are updated Betas of the "UEK3" Linux Kernel 3.8.13-16 and the dtrace-utils tools available too. With these, you now can DTrace PHP applications under Apache or with php-fpm, as well as command line PHP scripts.

He includes the full instructions on how to install the Oracle Linux distribution and grab the Oracle Instant Client libraries used for the "playground" packages. Next up is the PHP install - a quick call to yum - and a simple script showing how to set DTrace probe. Some sample output of the trace is shown and an slight modification to the probe showing how to find only calls from a certain source.

tagged: dtrace oracle linux package playground prebuilt tutorial install

Link: https://blogs.oracle.com/opal/entry/dtrace_php_using_oracle_linux

Chris Jones:
DTrace with PHP Update
Sep 05, 2013 @ 14:06:16

Chris Jones has posted an update to his previous article about DTrace and PHP (found here) and some of the updates Oracle has made to introduce things like "user-level statistically defined tracing" (USDT).

At the end of last year, I blogged about Adding DTrace Probes to PHP Extensions and how Linux's SystemTap could be used to trace the DTrace probe points. Since then, Oracle's Linux's DTrace project has been making great strides. The latest Oracle Linux UEK3 Beta kernel was just released. It comes with DTrace 0.4 and also supports "User-Level Statically Defined Tracing" (USDT) for the first time. This motivated me to make sure PHP DTrace worked well with "real" DTrace, not just with SystemTap's wrappers.

He also includes a list of the other updates in this version like:

  • DTrace build script changes from PHP 5.5 were merged back to PHP 5.4
  • A 'make install' recursive dependency issue that caused Zend/zend_dtrace.d to be deleted was fixed.
  • PHP DTrace configuration now uses the correct PIC or non-PIC objects. This also fixed building PHP when any extensions were built 'shared'.
  • PHP's OCI8 2.0 extension now builds correctly with "real" DTrace.

He finishes off the post with the list of steps you'll need to follow to get this latest version up and running.

tagged: dtrace oracle update systemtap linux

Link: https://blogs.oracle.com/opal/entry/dtrace_with_php_update

Chris Jones:
Adding DTrace Probes to PHP Extensions
Dec 07, 2012 @ 15:35:09

In a new post to his site (related to the topic of this previous post) Chris Jones shows you how to setup and use DTrace support in your PHP installation for enhanced debugging abilities.

The powerful DTrace tracing facility has some PHP-specific probes that can be enabled with --enable-dtrace. DTrace for Linux is being created by Oracle and is currently in tech preview. Currently it doesn't support userspace tracing so, in the meantime, Systemtap can be used to monitor the probes implemented in PHP. This was recently outlined in David Soria Parra's post Probing PHP with Systemtap on Linux.

His examples are using the Oracle flavor of linux, but they should work for just about any unix-based system out there. He installs the tool via a yum package and compiles the latest PHP source with the "enable-dtrace" flag. He includes a simple script to connect to an Oracle database and shows the contents of the resulting "functrace.stp". He also shows how he added more "prodbes" (the points DTrace uses to profile) into the OCI8 extension for PHP (steps and source included).

tagged: dtrace extension probe tutorial compile oci8 extension

Link:

David Parra:
Probing PHP with Systemtap on Linux
Dec 05, 2012 @ 16:41:30

David Parra has a new post to his site today about a method of using Systemtap to profile PHP as the code executes (as an alternative when DTrace may not be available.

PHP introduced DTrace support with PHP 5.3, enabling probing points in the PHP executable that can be used to simplify probing of PHP applications without having to the PHP implementation details. We enabled probes on function calls, file compilation, exceptions and errors. But this has always been limited to the operating systems that support DTrace. With the popularity of DTrace, Systemap programmers decided to add a DTrace compatibility layer that allows to use DTrace probes as Systemtap probing points as well.

Thanks to a recent commit to the PHP 5.5 branch, your PHP installation (compiled with DTrace support) can be executed with the "stap" command and searched for probe points. He includes a simple Systemtap script that counts the calls of a specific function to get you started.

tagged: probe profile systemtap dtrace compile tutorial

Link:

David Soria Parra's Blog:
PHP 5.3.99-dev and DTrace Part I
Apr 29, 2010 @ 17:17:32

As David Soria Parra mentions in a recent post to his blog, the DTrace functionality has been backported to the PHP 5.3 branch and gives developers a bit more information about what's happening inside their applications.

For those not following the PHP development. We backported the DTraces probes from the abandoned PHP 6.0 branch, back to the new trunk PHP 5.3.99-dev. It is called 5.3.99 because the PHP dev community has not decided yet on a version number (5.4 or 6.0).

He gives the configure line to get it working on Solaris and Mac OSX and a sample line of code to ensure everything's working correctly. The results show the full execution of the example. This functionality can replace this extension from the PECL repository.

tagged: dtrace trace backport osx solaris

Link:

IBuildings techPortal:
Analysing PHP web applications with dtrace
Nov 25, 2009 @ 15:19:07

On the IBuildings techPortal today there's a new podcast posted in the Dutch PHP Conference series - David Soria Parra's talk on analyzing web applications with Dtrace.

DTrace is the Swiss army knife to analyze the behavior of applications and enabling you to gather detailed information from the bottom of your application stack up to the top. DTrace is used by system administrators and developers, on Solaris, Mac OSX and FreeBSD, to do in-depth analysis of an application, to find and reduce performance bottlenecks and problems in productive system. The talk will give an introduction how to use DTrace's capabilities in web development, reflect the current state of DTrace support in PHP and show examples how to trace PHP script in production.

You can listen to this latest episode via their in-page player.

tagged: podcast dpc09 dtrace

Link:

Experimentalworks Blog:
DTracing PHP
Dec 22, 2008 @ 21:19:10

On the Experimentalworks blog a recent post looks at using DTrace, the powerful tool to debug and trace problems in an application, with your PHP applications.

Dtrace is really powerful and trying to do an introduction to all it’s features is just not possible. Therefore I will just focus on the basics, that are needed to get our stuff working. The basic idea behind Dtrace is that the kernel and userland programs fire probes on a specific location in the kernel or the userland program.

He looks at the structure of a DTrace program as well as a list of probes that you can use to help track down the problem in your application. His "first example" traces the compile time of the app and, when run on the command line, returns the time in seconds.

tagged: dtrace tutorial example compile time structure probe

Link:

Johannes Schluter's Blog:
DTraceing around
Oct 13, 2008 @ 16:14:35

After singing the praises of DTrace for a while now, Johannes Schluter decided to show it off in a different way - introducing a collegue to it:

Yesterday, during a break at the Barcamp Munich, I gave Wolfram a short introduction on his Mac and decided to put some stuff here [in this post]. DTrace is a toolkit available on Solaris (Solaris 10 or OpenSolaris), recent MacOS versions and FreeBSD for mightier than tools like truss or strace but with way less impact. DTrace allows you to "hook" (called "probes") into the system and allows to do some analysis then.

He shows how to set up some of these "hooks" using D-script to wrap around a simple PHP script call. He alters the results to show things like the memory function its in, how much of the memory its using and a fun little script that "graphs" out the memory usage with "@" symbols.

tagged: dtrace tutorial example emailloc memory allocate

Link:


Trending Topics: