1

I'm struggling with xDebug profiling in WAMP. It works perfectly with browsers, I'm getting cachegrind.out files, but no luck if I try to execute a php script with command line. No cachegrind files are being generated.

Here is my php.ini file:

[xdebug]
xdebug.remote_enable = On
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "c:/wamp/tmp/profiler"

I have also tried with profiler_enable_trigger = 0. AlsoTried adding parameters:

php -d xdebug.profiler_enable=On script.php

and

php -dxdebug.profiler_enable=On script.php

Like described in This SO question

I even performed php --ini to know if on windows there was another php.ini file different from the one Apache used. It turns out that is the very same file:

Configuration File (php.ini) Path: C:\windows
Loaded Configuration File:         C:\wamp\bin\php\php5.4.12\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Since it's the same php.ini, I'm running out of ideas. Could you help me? If you need any other output, don't hesitate.

Community
  • 1
  • 1

1 Answers1

2

If you turn xdebug.profiler_enable_trigger on, then you need to set a cookie to trigger the profiler. As you can not set cookies on the command line, this won't work. For command line profiling, you need to have:

xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0

There is an issue at http://bugs.xdebug.org/view.php?id=1005 to add environment variable based triggers as well.

Derick
  • 35,169
  • 5
  • 76
  • 99
  • Thank you for your answer and for your link. As I previously said in my question, I also tried profiler_enable_trigger = 0 with no luck. I finally used a suse virtual box to profile the code, but I wonder why it didn't work in my windows machine. Thank you anyway Derick! – Héctor Paúl Cervera-García Nov 28 '13 at 14:46