So it just took me all night to figure out that in Xdebug ‘tracing’ is different to ‘profiling’.
It didn’t help that the xdebug.trace_output_name included an example format of ‘cachegrind.out.%s’. Why would you name a trace file cachegrind.out if only profile files are in cachegrind format!?
In my efforts to get profiling to work I found myself loading trace files into KCachegrind and getting the rather unhelpful message: “Could not open the file “/run/shm/xdebug/trace…xt”. Check it exists and you have enough permissions to read it.”
So the error message is about file permissions. I checked and checked and checked again but the file permissions were OK. The problem was I was loading a trace file, not a profile file.
So I gave up on KCachegrind and tried to get webgrind to work. Turns out loading a trace file (not a profile file) into webgrind doesn’t work either. I got the same problem reported by Sven about ‘parsers is undefined’. I fucked around trying to update the jquery.tablesorter plugin in webgrind, but the problem was due to the fact I was loading a tracing file, not a profiling file.
In the end I got it all figured out. Here’s my /etc/php5/mods-enabled/xdebug.ini file:
zend_extension=/usr/lib/php5/20131226/xdebug.so xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_mode=req ;xdebug.remote_host=127.0.0.1 xdebug.remote_host=10.1.1.203 ;xdebug.remote_port=9000 xdebug.remote_port=9999 ; http://www.xdebug.org/docs/all xdebug.profiler_enable=1 xdebug.profiler_output_dir=/run/shm/xdebug xdebug.profiler_output_name=cachegrind.out.%t.%R xdebug.auto_trace=1 xdebug.collect_assignments=1 xdebug.collect_includes=1 xdebug.collect_params=4 xdebug.collect_return=1 xdebug.collect_vars=0 xdebug.show_mem_delta=1 ;2 for HTML: xdebug.trace_format=0 xdebug.trace_options=1 xdebug.trace_output_dir=/run/shm/xdebug xdebug.trace_output_name=trace.%t.%R xdebug.var_display_max_children=-1 xdebug.var_display_max_data=-1 xdebug.var_display_max_depth=-1
The above config supports generation of tracing files and profiling files. I can now load my profiling files into KCachegrind and webgrind.
Everything is easy when you know how!