I am trying to configure Xdebug for cachegrind but I can't manage to enable the profiler feature in order to dump executed web pages.
I'm using the official guide (and a few more with similar settings) and it doesn't seem to work.
I've tried on both of my Linux machines (Ubuntu and Fedora). Xdebug is working fine for debugging and I can start valgrind --tool=cachegrind
for an application so both should be installed properly.
I was activating and deactivating profiler_enable and profiler_enable_trigger options in php.ini and restarting the server, no luck. Changed the output directory as I thought that it might be related to permissions. Using the ?XDEBUG_PROFILER=1
flag in the URL as a parameter doesn't seem to help either.
Any other clues related to the configuration of cachegrind?
The following basic xdebug.ini should do the trick:
; check that the path is ok for you
zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.profiler_enable=1
xdebug.profiler_output_name = cachegring.out.%s
xdebug.profiler_output_dir = /tmp
Note that it enables the profiler for every request what is a significant performance issue. However you should test if this works first. If you see that it works, disable it per default.
About valgrind.
Note that it is not possible what you are trying to do. The xdebug profiler isn't designed to work with / connect to valgrind. It just uses the same output format as valgrind. So, the format is the same as for example:
valgrind --tool=cachegrind --cachegrind-out-file=test.cachegrind ls -al
Usually you'll analyze the cachegrind files using a GUI program like kcachegrind
on linux and wincachegrind
on windows.