views:

243

answers:

2

I have set up Eclipse PDT on Galileo. I'm able to run and debug PHP sites that are set up on XAMPP. The thing is, I want to profile one of the sites, but cannot for the life of me figure out how to set this up. There is a profiling menu when I right-click the PHP project, but no indication of how to proceed from there. BTW I'm using Xdebug as the debug engine.

A: 

I couldn't get profiling work with Xdebug in Eclipse either.

However, you don't really need Eclipse for profiling, it has little or no value. Once you turn on the profiling in xdebug, all the debug information is dumped in a temp directory and you can just view it using any tools (I prefer webgrind).

ZZ Coder
I turned to Eclipse after trying without success to get the profiling output from xdebug. I've set the profiling options as: xdebug.profiler_enable = 1; xdebug.profiler_output_dir = "C:\xampp\tmp\php_profiler". No output files are generated in the php_profiler folder.
kalengi
@kalengi: whenever I see a \t in a path, I wonder... what happens if you replace the backslashes with forward slashes? Also, don't forget to restart Apache after the change.
Narcissus
@Narcissus it still doesn't work. Is there some way to verify that the options are having any effect at all?
kalengi
You can make a call to phpinfo() and see what shows up in the xdebug section.
Narcissus
The xdebug section shows the right settings. What I was looking for is a way to get PHP to give me feedback on how it's responding to particular options. As an example, I made a deliberate error: xdebug.profiler_enable = "on (no closing quote) and I got an error message box on starting up Apache: 'unexpected BOOL_FALSE in C:\xampp\php\php.ini on line 2177'. Now if I could provoke some message box to show that xdebug profiling has actually commenced, then I would know whether it starts at all.
kalengi
+1  A: 

I came across the solution to my real problem: Getting Xdebug to output profiling files. As @"ZZ Coder" has mentioned, you don't really need Eclipse to profile PHP. I checked the Xdebug source files and realized that the filename format that you supply in the options (php.ini) gets validated and determines whether the profiling is turned on or not. Now this is not surprising, but what's interesting is that the php.ini (supplied with XAMPP 1.7.2) file already had the Xdebug option:

xdebug.profiler_output_name = "xdebug_profile.%R::%u"

On Windows, this output filename format is invalid due to the two colons so the option fails validation and profiling is not turned on. I edited this to the format below and the profiling started working as expected:

xdebug.profiler_output_name = "xdebug_profile.%R-%u"

Nothing is sacred when it comes to bugs it seems :)

kalengi