6

I'm looking for a PHP profiler that works with Zend Server (CE). From what I can tell, XDebug is a pain to setup with Zend Server. While Zend Debugger is free (as I understand it), the Profiler is only on Zend Studio.

Any other options?

Tim Lytle
  • 17,549
  • 10
  • 60
  • 91
  • 2
    To someone(s) voting to close, Zend 'Server' is a PHP stack - I'm fairly certain this isn't something for ServerFault. – Tim Lytle May 20 '10 at 21:02
  • Does the Zend Debugger let you pause the program via Ctrl-Break or Ctrl-C? (I'd be surprised if it didn't.) Then you can use the random halt technique, which I think is as good or better than any profiler for finding the code you need to optimize. – Mike Dunlavey May 20 '10 at 21:17
  • While random halt may work normally, in this case I really need to see a break up of execution times. I know certain calls are taking time, I just need to see what the proportions are - and I don't want to litter the code with a bunch of timing checks, but that may be what I end up doing. – Tim Lytle May 20 '10 at 21:47
  • Here's how you can find that out. Take 10 or 20 random samples of the call stack. You want to know what fraction of time is spent under a particular function? It is the fraction of samples with that function on them. Want to know the same thing about particular lines of code? Same idea. If a function does not show up, or only shows up on one sample, it doesn't take much time, so you probably don't care about it. It may seem unusual or strange, but if you try it, you'll see that it does tell you what you need to know. – Mike Dunlavey May 27 '10 at 02:14
  • This is a discussion, in the context of gprof, but the issues are general: http://stackoverflow.com/questions/1777556/alternatives-to-gprof/1779343#1779343 – Mike Dunlavey May 27 '10 at 02:19
  • @MikeDunlavey wtf how could a call stack ever be random? – Eugene Mar 31 '14 at 14:29
  • @Eugene: Random pausing is a technique that lots of people know, even though it's not taught in academia, or if it is mentioned, it is denigrated. But check [*Agner Fog*](http://www.agner.org/optimize/optimizing_cpp.pdf). He says "There are various alternatives to using a profiler. A simple alternative is to run the program in a debugger and press break while the program is running. If there is a hot spot that uses 90% of the CPU time then there is a 90% chance that the break will occur in this hot spot." If you've got 8 minutes, watch [*this*](https://www.youtube.com/watch?v=xPg3sRpdW1U). – Mike Dunlavey Mar 31 '14 at 15:22
  • 1
    @Eugene: To answer your question "how could a call stack ever be random", consider this program: `main` has a loop of 10 000 iterations, in which it calls `A`, then `B`. `A` does a lot, including maybe IO or library calls, taking 1ms. So does `B`. The whole thing takes 20 seconds. If you Ctrl-C it at random in that time, you have 50% probability of seeing `A` on the stack, and 50% `B`. That's how a stack sample can be random. – Mike Dunlavey Mar 31 '14 at 18:25

3 Answers3

3

A late answer, but might still be handy for those who find this question via searching (like I did).

I have Zend Server CE and PHPStorm on a Windows configuration and also wanted to profile some pages. It turned out that since a while it is just built-in in PHPStorm! With the explanation on this page: http://devnet.jetbrains.net/thread/432088 it was a breeze to get it up and running.

PHPStorm is not free (it is for individuals that do open source development) but its prices are absolutely affordable and are paid back for within days looking at the increasement in productivity.

fietserwin
  • 217
  • 2
  • 10
  • I've been hearing good things about PHPStorm - I have a free copy of ZendStudio (as a ZCE), but I plan on trying it out. – Tim Lytle Sep 03 '12 at 17:33
3

I wish I could will you Zend Studio, as the profiler component is quite nice.

XDebug (standalone tip) may be your only option, unfortunately.

Do you have the option of upgrading to Zend Server 5 Professional edition? The Code Tracing feature would help you in profiling. Or, have you looked at PQP or DBG for Eclipse?

I wish I could be more help. The company I work for uses Zend Server for all deployments and the engineers all have Zend Studio.

Good luck.

Community
  • 1
  • 1
allnightgrocery
  • 1,370
  • 1
  • 8
  • 15
  • I've considered Zend Studio; however, the licensing keeps me from going with it. I have no problem purchasing expensive software that I can only use on one system at a time, but Zend wants a license for every developer for each system they use. That's crazy. – Tim Lytle May 24 '10 at 21:00
  • That is a headache, for sure. A single server license would be a little more "centralized", as you could VM and run wherever you needed or put on your development sandbox. The code tracing isn't as mature as the Zend Debugger/Profiler but it is a step forward. Have you tried NetBeans' XDebug integration? Maybe it's a little more integrated than Eclipse PDT. Just a thought. – allnightgrocery May 24 '10 at 21:16
  • 1
    The problem with XDebug is that it (to my knowledge) doesn't play nice with Zend Server (or maybe it's the other way around). I've been happy using Zend Server CE as a dev stack - perhaps it's not too hard to get it working with XDebug. – Tim Lytle May 25 '10 at 17:10
  • That's really interesting. Can you point me to a scenario that can illustrate this? I'm most intrigued. – allnightgrocery May 25 '10 at 17:26
  • I guess I didn't follow the links far enough. Seems that it's only an issue using XDebug with Zend Debug (or a few other modules). – Tim Lytle May 30 '10 at 02:29
  • I hope that means you're on the path to success. Good luck. – allnightgrocery May 30 '10 at 12:47
1

You should consider the Semantic Designs PHP Profiler.

Doesn't require XDEBUG to be installed. Doesn't require any special configuration of your server. Works with huge PHP applications.

Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
  • Can't seem to find this info on the site - is it Windows only? – Tim Lytle May 30 '10 at 10:47
  • @Tim Lytle: ... actually, the instrumenter tool runs only on Windows. The profiled code can run on any PHP server, on Windows or Linux or wherever else PHP runs. – Ira Baxter Jun 06 '10 at 04:26