php5-xdebug: How to Profile a PHP application
This packets permits to get a trace of all the calls in a PHP scripts with the relative execution times. These information are extremely useful to optimize the code and to find unexpected behaviours.
To get it you need to execute (on Debian/Ubuntu)
aptitude install php5-xdebug
The minimal configuration to activate it is
zend_extension=/usr/lib/php5/20090626/xdebug.so xdebug.profiler_enable=1 xdebug.profiler_output_dir=/tmp
After that you’ll find the result of the trace of the execution in the /tmp directory in files named
cachegrind.out.
These files are extremely difficult to reed so it is mandatory tu use some graphic tools to access them. A good one is kcachegrind.
This library, can overload the server, so it is a good practice to remove it when it isn’t needed.