---
name: "php4-apd"
section: "1"
platform: "linux"
package: "php4-apd"
version: "0.4p2-6"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/php4-apd"
---

# php4-apd(1)

PHP code execution profiler and debugger

## NAME

php4-apd - PHP code execution profiler and debugger

## DESCRIPTION

This manual page documents briefly the **php4-apd** package and **pprofp** command. This manual page was written for the Debian distribution because the original program does not have a manual page.

**php4-apd** (the Advanced PHP Debugger) is a full-featured PHP  profiler/debugger that is loaded as a zend\_extension. It aims to be an  analog of C's gprof or Perl's Devel::DProf, and provides PHP developers  with a number of additional functions which can be used to obtain  internal code execution details such as timing information, function  call tree and stack backtrace. This is particularly useful for  performance profiling purposes.

Once installed, APD provides a number of additional functions which you can place in your PHP code for either profiling or debugging. The  debugging functions are:

- **array apd\_callstack()**

  Returns the current call stack as an array (very cool).

- **apd\_cluck(\[string warning\[,string line delimiter\])**

  Behaves like perl's Carp::cluck. Throw a warning and a callstack. The default line delimiter is "\<BR /\>\\n". Deprecated for users of PHP4.3+: use the internal debug\_backtrace() and debug\_print\_backtrace()  instead.

- **apd\_croak(\[string error\[, string line delimiter\]\])**

  Behaves like perl's Carp::croak. Throw an error, a callstack and then exit.  The default line delimiter is "\<BR /\>0.  Deprecated for users of PHP4.3+: use the internal debug\_backtrace() and debug\_print\_backtrace()  instead.

- **array apd\_dump\_regular\_resources()**

  Return all current regular resources as an array.

- **array apd\_dump\_persistent\_resources()**

  Return all persistent resources as an array.

- **override\_function(string func\_name, string func\_args, string func\_code)**

  Syntax similar to create\_function(). Overrides built-in functions (replaces them in the symbol table).

- **rename\_function(string orig\_name, string new\_name)**

  Renames orig\_name to new\_name in the global function\_table.  Useful for temporarily overriding built-in functions.

The profiling functions can be placed at the start of your PHP code to force APD to dump profiling information out to text files in the  directory defined in apd.dumpdir. These functions are:

- **apd\_set\_pprof\_trace()**

  Dumps a tracefile named "pprof.\<pid\>" in your apd.dumpdir, which by default is set to /var/log/php4-apd/ on Debian systems. The tracefile is a machine parsable output file that can then be processed with the  **pprofp \<tracefile\>** command. Do a 'pprofp -h' for detailed help, there are lots of options for  sorting and formatting the output. Loads of fun here if your PHP is not  running as fast as you'd like!

- **apd\_set\_session\_trace(N)**

  Dumps a human-readable session trace named "apd\_dump\_\<pid\>" in your  apd.dumpdir. This is the old way of doing things, noted here just because it  still works (for now). It's been deprecated, so YMMV. Better to use a pprof  trace instead if you can. 'N' is an integer that sets what items will be  traced: just use a value of 99 for now, that'll turn on all implemented options.

More information can be found at http://pear.php.net/apd

## OPTIONS

At present options are configured in php.ini by setting variables that are passed to APD at startup. This may change in future.

- **apd.dumpdir**

  The directory used to store output files. Set to /var/log/php4-apd/ by default on Debian systems.\

## AUTHOR

This manual page was written by Jonathan Oxer \<jon@debian.org\>, for the Debian GNU/Linux system (but may be used by others).
