Archive for the ‘code’ Category

xDebug & apd for Xampp linux 1.6.2

For all web developers willing to profile their scripts, you will find below an archive containing xDebug and apd compiled for Xampp 1.6.2 under linux.

xdebug_and_apd_for_xampp-1.6.2.tar.gz (hosted @ box.net)

Copy your archive in the /opt folder, then uncompress it and restart your xampp server :

cp xdebug_and_apd_for_xampp-1.6.2.tar.gz /opt
tar -xvzf xdebug_and_apd_for_xampp-1.6.2.tar.gz
lampp/lampp restart

This archive features xdebug.so, apd.so and php.ini configured so you will just need to restart your web server after uncompressing it.

Then, each time a PHP script is executed, a cachegrind.out file will be created in /tmp . This file is a trace of the whole script’s execution and brings a clear look on what is going on while the script is running. I suggest opening this file with kCachcgrind :

kcachegrind-1.png

kcachegrind-2.png

You can also use the xdebug functions inside your code (at the end of the main script):

if (extension_loaded('xdebug') ) {

    echo "<p>Memory Usage : "  . xdebug_memory_usage(). "</p>";

    echo "<p>duration : "  . xdebug_time_index(). "</p>";

}

that will print :

Memory Usage : 251992

duration : 0.00704598426819

Enjoy, and have a nice profiling :)