You are here

zend

Debugging in Zend Studio for Eclipse

I've been playing with the Zend Studio trial and found it to be really good. Eclipse is an excellent PHP editor but Zend manage to bring some of Eclipse's real power to PHP, that which you can see when writing code in Java.

One useful tool is local debugging. Yet Zend Studio's built in PHP doesn't include extensions such as MySQL, making it not overly useful when you start to use it properly. Now, at this point you should perhaps be running the code on the server and using remote debugging, but what about unit tests? Another excellent feature in Zend Studio is the PHPUnit support. But you can't test MySQL methods as there's no support.

So, here's how to get PHP extensions working in Zend Studio 6 (on Windows, anyway - yes, this is what I use at work..)

Locate the PHP directory inside Eclipse's plugins. You can find this by looking at the preferences for the PHP executable.
Download the binary archive (not installer) of the same PHP version from php.net.
Copy the extensions from the ZIP into the PHP directory.
Edit the php.ini in the same directory and add the line:

extensions_dir = .

(Note: PHP claims to be using c:\windows\php.ini - it is not).
Open the default php.ini from the ZIP you downloaded, and copy all the extension (.dll) lines to your live php.ini.
Also manually add php_mysql.dll and php_mysqli.dll, which are NOT compiled in to Zend's PHP as the example php.ini file says (Zend's php.exe is a special build I believe).

Now try debugging some PHP which uses extensions, and it'll work. Unless you have bugs. Then it'll need debugging.

Keywords: 

PHP Frameworks

I've finally become sick of writing my own frameworks for websites. I keep reinventing the wheel, and while I think I do some novel stuff I'm never going to match the breadth functionality available from frameworks developed by dozens or hundreds of people. Time is money and it's time to save (make) some money.

I've been looking at two frameworks:

ZendFramework

Pros

  • PHP5 only.
  • Modular enough to easily use within existing codebases.

Cons

  • Terrible documentation. I could not find one single example of even how to get started: I had to work it out from first principles.
  • Awful documentation.
  • Documentation leaves you reading source code to try to work out how to actually pass the parameters mentioned in the docs to methods.

Code Igniter

Pros

  • Easy to build complex sites from nothing and retain good practises.

Cons

  • PHP4 - no excuses now, PHP5 is essential. While 5 is far from ideal, PHP4's object model is unacceptable. Of course, CI being written in PHP4 doesn't mean that I have to write my code in 4 - but the very mention of PHP4 put me off enough to spend a day fighting ZendFramework before coming back for a second look.

Okay, there's not much here, but as I work through some projects I'll find things to say.

Saying that, anyone want to hire me for a project? Don't let this Drupal site with no effort spared "default theme and logo" look fool you, I am a real life web developer - I actually like writing business applications! Seriously.

Subscribe to RSS - zend