How do I set up PHP profiling on Eclipse?

2019-04-13 03:32发布

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.

3条回答
Anthone
2楼-- · 2019-04-13 03:41

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).

查看更多
Deceive 欺骗
3楼-- · 2019-04-13 03:50

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 :)

查看更多
【Aperson】
4楼-- · 2019-04-13 04:03

Set xdebug.auto_profile = 1 in your php.ini file.

查看更多
登录 后发表回答