14

I've got a strange issue. I've setup XDebug to profile a PHP application we're working on. I believe everything is setup correctly but I get no output when I run it. My configuration looks like this:

zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
[XDebug]
xdebug.profiler_append = 1
xdebug.profiler_enable = 0 (I've tried this both on and off)
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "/debug/xdebug/profiler_output_dir"
xdebug.profiler_output_name = "cachegrind.out.%p"

All the phpinfo() settings match up like they should. The permissions on the output directory are set to 777 right now just so I can test it. I've tried using a directory under public_html as well but no luck. The URL I'm using to launch the profiler is:

http://example.com/my_page.php?XDEBUG_PROFILE
-or-
http://example.com/my_page.php?XDEBUG_PROFILE=1

Neither works. Any help would be GREATLY appreciated!! This app has a 5-6 second page load time and I haven't been able to trace it through code.

k0pernikus
  • 60,309
  • 67
  • 216
  • 347
John Swaringen
  • 731
  • 4
  • 11
  • 29

5 Answers5

18

There is also problem with /tmp folders on some distributions, i couldnt get output on centos 7 and then i found this

So, i have set

xdebug.profiler_output_dir=/home/jirka/profile

chmod 777 /home/jirka/profile and its ok now.

Jonathan
  • 6,741
  • 7
  • 52
  • 69
Aiphee
  • 8,904
  • 3
  • 18
  • 16
  • 3
    There's more information about that `PrivateTmp` setting [here](https://securityblog.redhat.com/2014/04/09/new-red-hat-enterprise-linux-7-security-feature-privatetmp/). It "sets up a new file system namespace for the executed processes and mounts a private `/tmp` directory inside it, that is not shared by processes outside of the namespace. This means that processes running with this flag would see a different and unique `/tmp` from the one users and other daemons sees or can access." – TachyonVortex Feb 04 '15 at 17:42
  • Thanks for this. It turns out my OpenSUSE 13.1 has the same configuration and moving the profiler output elsewhere solved the problem. – savedario Apr 05 '15 at 10:33
11

Comment out xdebug.profiler_output_dir and xdebug.profiler_output_name and see whether you can find the output under /tmp/.

Hamid Nazari
  • 3,905
  • 2
  • 28
  • 31
  • 3
    Hamid, Turns out you were on the right track. I'd forgotten to put the full path to the output directory. Here's the final solution: xdebug.profiler_append=1 xdebug.profiler_output_dir ="/home/username/debug/xdebug/profiler_output_dir" xdebug.profiler_output_name = "cachegrind.out.%s.%H" – John Swaringen Aug 23 '10 at 17:51
6

Another possible cause of this issue is the permissions on the folder of profiler_output_dir.

Adding write permissions to the group and owner resolved the issue for me:

sudo chmod go+w /home/dimitris/cachegrind/
Dimitris Baltas
  • 3,115
  • 3
  • 34
  • 26
1

The full path was required, not just the path:

xdebug.profiler_append=1
xdebug.profiler_output_dir ="/home/username/debug/xdebug/profiler_output_dir"
xdebug.profiler_output_name = "cachegrind.out.%s.%H"
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
1

Also, beware of access restrictions, such as access rights, groups, owner and SElinux...

greg
  • 696
  • 1
  • 9
  • 16