Xdebug Profiler Files Not In xdebug.profiler_output_dir
Published: January 17, 2019
Something that’s tripped up both myself and devs that I’ve worked with is not finding Xdebug profiler files in the expected directory (
/tmp by default).
It usually goes something like this…
- Enable the Xdebug profiler by adding
xdebug.profiler_enable_trigger = 1to a
- Make a request with
?XDEBUG_PROFILE =1in the GET string.
- Check for the output file in
- Pull out hair because it’s not there.
This may be accompanied by running a sanity check, only to be accompanied by more hair pulling…
$ php -r 'var_dump(ini_get("xdebug.profiler_output_dir"));' string(4) "/tmp"
If you find yourself in this situation, the likely cause is that your system is using PrivateTmp.
In this case the cachegrind file will actually be placed in a folder like this:
The best way to find the file in this case is as follows:
sudo find /tmp/ -name '*cachegrind*'