How to set Xdebug for Drupal and analyze profiling logs

June 06, 2014
1 min read

Xdebug is a free open source PHP extension and is a developer's powerful tool when it's come to: tracing, profiling, debugging, and creating code coverage statistics. Documentation and installation guide can be found here. To activate xdebug extension we need to open our php.ini file and add these entries:


zend_extension=/path/to/your/php/extension/xdebug.so
xdebug.profiler_output_dir=/tmp/xdebug_profile
xdebug.profiler_enable_trigger=1
xdebug.profiler_enable=0
xdebug.auto_trace=0
xdebug.collect_params=1
xdebug.collect_return=1
xdebug.collect_vars=1
xdebug.trace_output_name="cachegrind.out.%s.%p.%u"
xdebug.profiler_output_name="cachegrind.out.%s.%p.%u"
xdebug.trace_format=1
xdebug.extended_info=1

Having restarted your web server because we changed php.ini, you can check
the output of phpinfo() or run php -m at the command line.
In each case, xdebug must be listed twice, once as a PHP extension, and as a Zend extension as well.

We use profiling feature of Xdebug for counting how many times a statement has been excecuted and how much execution time it took. To do that you must put the next URL parameter "?XDEBUG_PROFILE=1" on the page you need to track. In /tmp/xdebug_profile directory you'll have now an "cachegrind.out.%s.%p.%u" file that is not meant for human redability and it can be opened with tools like WinCacheGrind or KCacheGrind.

Share on:

Want to stay on top of everything?

Get updates on industry developments and the software solutions we can now create for a smooth digital transformation.

* I read and understood the ASSIST Software website's terms of use and privacy policy.

Frequently Asked Questions

ASSIST Software Team Members

See the past, present and future of tech through the eyes of an experienced Romanian custom software company. The ASSIST Insider newsletter highlights your path to digital transformation.

* I read and understood the ASSIST Software website's terms of use and privacy policy.

Follow us

© 2025 ASSIST Software. All rights reserved. Designed with love.