开发者

How do I set up PHP profiling on Eclipse?

开发者 https://www.devze.com 2022-12-28 23:50 出处:网络
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 s

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 indi开发者_高级运维cation of how to proceed from there. BTW I'm using Xdebug as the debug engine.


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


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号