How to set Xdebug for Drupal and analyze profiling logs | ASSIST Software Romania
get in touch
>

LIKE

SHARE

Facebook Share Tweet LinkedIn Share

FOLLOW

LinkedIn Follow Xing Follow
Gabriel Paval

Web Developer at ASSIST

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.

Vous souhaitez nous contacter ? 

Si vous êtes intéressés par nos services de développement de logiciel, si vous souhaitez rejoindre notre équipe, ou si vous souhaitez tout simplement en savoir plus sur nous, nous sommes à votre disposition. Contactez-nous ! Écrivez-nous et un membre de l'équipe ASSIST vous répondra dans les plus brefs délais. Nous pourrons certainement vous ASSISTer.

CONTACTEZ-NOUS