Tools make PHP shine

Zend Studio and PHPEd lend a commercial polish to open source Web development

the entrenchment of commercial Web application languages — most notably Microsoft’s ASP (now ASP.Net), Sun's JSP, and Macromedia's ColdFusion -- seems to leave little room for open source alternatives. Yet one open source Web scripting language has truly hit the big time: PHP(which bears the fashionably recursive acronym "PHP: Hypertext Preprocessor").

Of the roughly 10 million sites running on the Apache Web server, nearly half are running PHP, according to , a consulting group that gathers statistics on Internet online services. More surprising, the U.K.-based Internet research and analysis company Netcraft   reported last August that the use of PHP on Windows Web servers is skyrocketing and is on course to overtake Macromedia's ColdFusion.

Commercial scripting languages have drawn their success from powerful and widely used development tools: ASP has Visual Studio, Cold Fusion has Dreamweaver, and JSP has a variety of tools from commercial sources such as Borland and from open source projects such as Eclipse  and NetBeans . PHP's enormous success, however, is not tied to specific tools. Rather, the combination of a code editor and a browser is likely the most common PHP development environment.

But commercial alternatives do exist. The gold standard is Macromedia Dreamweaver , which counts PHP among its many supported Web application languages. Commercial tools dedicated solely to PHP development are rare. Two of the most often used tools are NuSphere's PHPEd 3.3 and Zend Technologies' Zend Studio 3.0.2.

I used two platforms for testing: an Apple 17-inch PowerBook running OS X 10.3 (Panther) with a Power Mac G5 running OS X 10.3 Server; and a Fujitsu Athlon-M Lifebook running Windows 2003 Server and hosting Linux under Microsoft's Virtual PC.

PHPEdPuts It All in One Box

NuSphere PHPEd and Zend Studio match up closely in terms of core functionality. PHPEd is limited to Windows and Linux, which restricts its audience but will likely satisfy the majority of PHP developers. The Windows version of PHPEd includes remote debugger executables for platforms that PHPEd does not support, including OS X. I tested the product using Windows XP.

Although the idea of platform-limited tools for a cross-platform language rankles me a bit, I have few other reservations about PHPEd. Three features in particular stand out: strong database support, an embedded browser,

and online documentation. NuSphere’s IDE (integrated development environment) has a built-in database client with viewing, editing, and query capabilities for MySQL and PostgreSQL. The embedded Web browser overlays the editor window by default, but its layout is fully customizable.

For online help, NuSphere encoded PHP, HTML, CSS (Cascading Style Sheets), MySQL, and several other manuals into Windows HTML help system files. Hard-core open source developers are bred to live without such platform-bound advantages, but the difference between the PHPEd native Windows approach and Zend Studio’s platform-agnostic Java manifests itself in productivity.

Unlike Zend Studio, PHPEd neither checks as you type nor flags coding errors while editing. But those are relatively trivial shortcomings compared to the editing features unique to PHPEd. The help system plays a role in the editor by displaying documentation relevant to the context of the programmer’s work. The editor supplies the expected code completion features — as does Zend Studio, but PHPEd takes editing a few steps further.

PHPEd’s templates insert well-formed boilerplates for common PHP and HTML elements. Similarly, PHPEd can close HTML and XML tags for you, and it can show you which tags and attributes are appropriate given your location within the document.

PHPEd’s built-in database handling resolves one of open source’s greatest challenges: the use of an external database in an application. PHP makes this easier with its standard set of database functions, but developers often need a place to start.

The embedded database client allows you to locate all of the running databases on a given server. With this embedded client in place, you can drill down from the top level, where tables and user permissions are defined, to the bottom level, where field content is shown.

PHPEd’s database form wizard generates PHP/HTML code that will update, add, or view rows in a given table. The wizard not only creates the server-side code, but it generates client-side JavaScript for field validation and applies presentation styles through easily editable configuration files.

The last laudable feature is PHPEd’s NuSOAP wizard.

Although SOAP is not rocket science — especially in PHP — the NuSOAP wizard gives developers a good place to start. The wizard uses WSDL to query the list of SOAP services at a given URL. When you select a service, PHPEd inserts the necessary PHP code into your file.

Some readers may think it unfair to compare a cross-OS Java IDE to one written specifically for a pair of operating systems. Given the enormous productivity advantages that PHPEd provides, developers should simply accept that they’ll have to use Windows or Linux for their PHP projects. This small concession is worth it, because PHPEd is a proper, world-class IDE for PHP code.

Does PHPEd top Dreamweaver? Not even close, but then matching Dreamweaver doesn’t appear to be the objective. By dedicating itself to a single programming language, NuSphere has managed to create a powerful IDE in PHPEd that is as easy to learn and use as the PHP language itself.

Zend’sinside angle

Zend Technologies is closely allied with the PHP project, from whose principals the Zend Engine was created, an impressive open source performance accelerator for PHP. Zend sells products for PHP code encryption, caching and compression, and scalability. Like many open source projects with commercial partners, Zend's for-sale wares can be difficult to discern from features built into PHP. However, the Zend Studio integrated development environment is strictly commercial fare with no analogue in the PHP distribution.

Wizards drive Zend Studio installation. The IDE and its installer require a Java run-time of version 1.4.1 or later, a standard part of Apple's OS X 10.3 (which is downloadable ) . A license for the Zend Studio client includes a license for Zend Studio Server, which incorporates the Zend Optimizer code accelerator, a remote debugger module, and the Zend Server Center, a basic, moderately helpful Web-based configuration system for PHP.

The server requires too much skill to install on OS X. You'll be asked for the location of all of the Apache and PHP configuration directories. There are recommended defaults for these directories, but in many cases, Apple does not honor them. Zend Studio Server's installer offers to plug in its own PHP -- don't. It has fewer compiled-in capabilities, and in my case, it botched my Power Mac G5's PHP configuration so badly that it wouldn't run. Instead, replace Apple's PHP per the instructions on you install Zend Studio or Zend Studio Server.

Some of Zend Studio's interface behavior is quirky to the point of annoying. Property panes in the IDE's configuration interface sometimes popped up blank, and their contents filled in only after I switched to another pane and then switched back. Some dialog boxes didn't close when I clicked the OK or Cancel button, so, I had to click the OS X window manager's close button. It was unclear whether the changes I requested were applied or not. Zend's documentation link opens a browser to Zend's Web site, yet requests for help with PHP functions and variables point to It is possible, but far too difficult, to download the PHP reference manual and configure Zend Studio to use it; the process is arcane at best, and after a few attempts, I accepted that Zend likes its manuals online.

It's only after living through and learning to accept Zend Studio's shortcomings --buggy interface, difficult installation, and lousy documentation -- that its strengths become visible. The PHP debugger gives Zend Studio a key advantage over traditional methods.

Manually refreshing a browser window between edits may be The Manly Way to debug PHP applications, but it wastes a lot of time. Zend's GUI debugger gives users of other IDEs the breakpoints, variable inspectors, debug message console, and stack trace they expect. Zend Studio displays the incremental HTML output of a debugging session as text, and the IDE will open a browser for you so you can see what the rendered page will look like.

Zend Studio's editor is rather good. It knows PHP's syntax and standard libraries well. If you violate syntax in an obvious way -- say, by inserting an extra bracket or parenthesis -- the editor will immediately display Word-style red squiggly underlines; however, they don't always go where they belong, and often the tool tip that describes the error is too vague.

Zend Studio's code completion feature works quickly, displaying a scrolling list of variable and function names that match the letters you've typed. If you enter a function name, Zend Studio displays a prototype so you know the order and data type of the function's arguments. But the variable names are not always informative, and the editor doesn't warn you when you supply more or fewer arguments than a function requires.

Finally, an adjunct to the debugger is the Code Analyzer, which purports to discover errors in your code in one pass. Unfortunately, its output is often one line long because it stops parsing at the first major error, just as PHP would do. Although it caught some of the rookie mistakes I added to my files, with a dynamic language like PHP, it's not easy for an automated tool to discern between bad programming and creativity.

I appreciate the concept of the simple, minimal development environment that Zend Studio's creators had in mind, but the product feels more like shareware than a commercial IDE. The $195 retail price ($249 with support) is too dear for a script debugger, which is the only bit of functionality PHP developers would consistently use.

InfoWorld Scorecard
Setup (20.0%)
Ease of use (20.0%)
Value (10.0%)
Features (30.0%)
Documentation (20.0%)
Overall Score (100%)
NuSphere PHPEd 3.3 8.0 8.0 7.0 8.0 8.0 7.9
Zend Studio 3.0.2 5.0 7.0 5.0 6.0 4.0 5.5

Copyright © 2004 IDG Communications, Inc.