Archive for the ‘php’ Category

xDebug & apd for Xampp linux 1.6.3 …

Oh my God, Things are going so fast …

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

And  now, I can go on holidays!

Have a nice profiling :)

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 :)

Pear::DB is dead. Long live PDO!

Pear::DB is deprecated in favor of Pear::MDB2. I guess this is a good thing because MDB2 is faster, smaller and provides more features. I only guess because I am not a pear user,I do not like Pear as its installation is really weird and the documentation is sometimes insufficient.

By now, two database abstractions are still active in the PHP community : PDO & Pear::MDB2. I recommend PDO If you are writing your application using PHP5 and/or you want your application to be really fast (PDO is a PHP inner class). Pear::MDB2 can be a good thing for PHP4 applications or if you need a high-level of database abstraction in your application.

the Pear::MDB2 package : http://pear.php.net/package/MDB2/redirected

the PDO Class : http://php.net/manual/en/ref.pdo.php