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.

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.