Debug PHP Application with XDebug & KCacheGrind on Ubuntu 12.04

Install Xdebug, KCacheGrind on Ubuntu 12.04

Install PHP-Xdebug

sudo apt-get install php5-xdebug

Open php.ini, configure some line:
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp


Restart your apache

Check your phpinfo, and should contain xdebug information.


Install KCacheGrind

sudo apt-get install kcachegrind


Append XDEBUG_PROFILE=1  ( in the GET/POST request to your script )
Example, run your app at browser:



Then open KCacheGrind, and open your file in /tmp folder:
Example: cachegrind.out.11445



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s