Debug PHP Application with XDebug & KCacheGrind on Ubuntu 12.04

Posted: June 28, 2015 in Php, Programming/Development, XDebug

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
xdebug.profiler_enable_trigger=On

 

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:

http://localhost/myapp/index.php?r=my/dashboard&XDEBUG_PROFILE=1

 

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

Resources:
http://www.xdebug.org/
https://kcachegrind.github.io/html/Download.html

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s