So with the recent arrival of a MacBook Pro for work, I needed to setup my PHP development environment which usually consisted of Zend Studio, but that has YET to come out with a intel/universal release despite the fact that it’s 99% java. One of the useful things with Zend Studio is that you can debug and profile PHP sites with it, which I don’t actually use all that often, it’s still incredibly valuable. So Zend Studio may actually run fine on here through Rosetta, but word is, not very well and installer has major issues specially with latest version. What will not work at all is Zend Platform or Zend Studio Server, comprising of ZendOptimizer and what not, PHP extensions, which will not load into apache/php at all being PPC library files.
In comes Xdebug, an open source PHP debugging and profiling extension. It also totes a few nice features beyond that, like ability to give you stack traces for just about any error message, including notices and warnings. Installation of Xdebug was easy if you’re familiar with PHP extension compliation, plus if you’re trying out Komodo Pro also, it can install the extension for you and set it up. Xdebug is not too useful by itself, it’s best used with an IDE like Eclipse PHP IDE or Komodo, which allows you to view the PHP source file and step through it, set breakpoints, and see what variables contain what. This pretty much compares on-part with Zend Studio’s debugging abilities, with the added bonus of some other cool features.
The one thing I’d love to see be easier and as nice as in Zend Studio is the profiling of PHP code in Xdebug. This can be enabled and you can flag a page for profiling easily, what this does though is dump a file to a determined folder by the php.ini. This file is a cachegrind format file which can be viewed nicely in apps like KCacheGrind or WinCacheGrind. This would be cool and all if I weren’t on OS X. It doesn’t seem there’s any tool to view this data easily and nicely (specially as nice as a pie graph and such in Zend Studio) in OS X. This seems to be mostly due to the fact that these tools are all based around a tool called valgrind which is for linux and does not run on OS X that I can tell. What I did find after googling a bit is a perl script that will let me get some basic stats out of these files, ct_annotate.pl from the callgrind package. I found this after searching a bit on a mailing list as an attachment. My blog refuses to provide this file though.
I still haven’t had too much experience with Xdebug yet, but I’m impressed so far, just wishing for a visualization tool for cachegrind formatted data in OS X. I also tried Komodo Pro during this whole process, which seems like quite the powerful IDE. I was sparked to try this while looking into Xdebug, and not having any interesting in Eclipse, and running across someone in a similar boat over at Random Strings. This person, also a certified Zend Engineer, used to use Zend Studio but made the switch to Komodo Pro after purchasing a MacBook Pro. Seemed to be pretty positive, at least about debugging. My initial experience is pretty positive, seems to be quite powerful, the newest upcoming release has some nice features like CSS auto-complete, a HTTP inspector, and also ability to debug javascript via Firefox and an extension. I’m still going to give it a run through with my trial copy to get a good feel for it. My biggest problem so far is just that Zend Studio has an incredible auto-completion ability with it’s parsing of PHPdoc tags and being able to complete instance functions etc. Komodo Pro seems to be limited to class names and functions. I’ll probably use Zend Studio again on the MacBook Pro soon as it’s universal or available for intel, which Komodo Pro did very fast.
Check out some simple screenshots.
* Komodo Pro - Editing
* Komodo Pro - Debugging PHP page
* Simple profiling via ct_annotate.pl
Technorati Tags: php, programming, software