devxlogo

Review: Take Your PHP Web Pages Pro with the Zend IDE

Review: Take Your PHP Web Pages Pro with the Zend IDE

espite its similarity to ASP, PHP is rapidly becoming the language of choice for Web development. Its simplicity, power, and widespread support are all factors that have influenced an increasing user base. In fact, with the evolution of ASP to ASP.NET and the relative lack of public, low-cost servers that support the .NET platform, many are making the choice to migrate, not from ASP to ASP.NET, but from ASP to PHP.

In addition, people who just want to server-side script their Web sites have reasons to resist the move from Visual Interdev (ASP’s previous development environment) to Visual Studio.NET as overkill. As a result of their desire to keep things simple, more and more are moving to the cheaper, less revolutionary alternative. But not every Webmaster of every PHP-based site wants to eschew a full-featured development environment.

What PHP has lacked, until now, is a viable, enterprise-class development platform. Zend is attempting to change all that with the latest version of its IDE, Zend Studio Version 4. Zend is a firm supporter and believer in PHP, having been both a creator of PHP and an ongoing innovator.

This review is based on the beta of version 4, which has just been released and is available for download from zend.com. According to company officials, Zend will ship the finished product on February 10, 2005.

Getting Started
Installation of the software is a piece of cake. It has a very friendly installer that is helpful to novices and experts alike. It does all the heavy lifting of installing PHP for you and integrates it with your Web server. It downloads the Zend server and installs it for you with very little interruption. It’s efficient, it’s quick, and I tried several different combinations of the custom options, such as trying it with different Web servers?all of them worked beautifully.

Figure 1. Raring to Go: The Zend IDE has everything you’d expect from an IDE.

With your installation complete, you can launch the studio. Figure 1 shows the IDE’s fresh, default interface. If you owned a previous version, you can automatically import your configuration. The first time I ran it on Windows XP SP2, the XP application firewall seemed to make it lock up. Subsequent times it loaded and launched in a snap. On my test machine, a 1.5Ghz laptop running 1.5GB of memory, it took only 3 seconds to launch.

Everything you’d expect from an IDE is here, including a Code window, an integrated debugger, call stack, watch monitor, etc. The Zend IDE also boasts integration with the file system, various inspectors, and the holy grail of IDEs: database integration.

Once upon a time, database integration was a nice-to-have, or a distinguishing feature of an IDE. Nowadays, no IDE worth its salt can be without it. But what matters most about this feature is the level of integration it offers and the tool’s capacity for helping developers solve problems faster and write more stable programs.

Database Integration: A Few Frustrations
On paper, the database integration is very impressive. Studio boasts a fully integrated environment that supports MySQL, Oracle, Microsoft SQL Server, PostgreSQL, and SQLLite. In reality, this simply means that you can make a connection to any of these databases and run a query against them or test your SQL. There is no real integration beyond the fact that the connection manager is hosted by the same application as the code editor/debugger.

Figure 2. Playing with Data: Zend Studio’s database manager is inspecting the data from MySQL.

Compare that with Microsoft Visual Studio.NET, as an example, where, with a similar manager, you can connect to a database and then drag the database objects to your code window where connection code to talk to the database and run the specific query or stored procedure that you were inspecting is generated automatically. No such functionality exists here, which is a real shame, because it would be amazingly useful if you could pick up a MySQL table and drop it on a code window and have the mysql_connect and other relevant commands generated for you.

Figure 2 shows the database manager in action, where a MySQL database is being inspected. From here you can edit the existing data in the table, but there is no facility for adding new rows, which is very annoying, particularly if you are starting a new program and want some data preloaded. You have to manually type an INSERT query and run it.

Also, the choice of icon for editing is a little unintuitive. In Figure 2 you can make out the lock, which shows that the table is locked and you cannot edit (the “lock” icon is the yellowish one in the upper right). If you click this icon to unlock it, what you get is a red ‘X’ over the top of your lock. This confused me on several occasions, as the red X connotes something you are prevented from doing rather than something accessible.

Another annoyance is that you cannot edit the data in this grid when it is the result of a query. Figure 3 shows the same data, but instead of being a direct dump of the table (SELECT * FROM ANSWERS) it is a query of the data (SELECT * FROM ANSWERS WHERE ANSWERVALUE=2). It is identical in almost every regard, except that you cannot edit the data at all now.

Figure 3. Queried View of the Data: When data is queried rather than dumped, as shown here, you can forget about editing it.

There are two problems with this inability to edit queried data. First of all, it is very unintuitive. I was frequently confused about whether I could edit the data or not, until I realized that I needed to inspect the query entry window (which isn’t always visible) to see if I was in ‘query’ view mode or ‘table’ view mode. The second problem is that with large tables you cannot query a row in order to find it and edit it. With a tool such as MYSQLCC (which I had hoped Zend Studio might replace), you can run a SELECT query to find the record you want and make the edits that you want to the grid of returned results. Zend doesn’t offer this flexibility, which is a real shame.

Overall the data integration aspect of the IDE is a step in the right direction, but it has too many annoyances and too little hard functionality to be useful. For the time being I see PHP developers continuing to use a tool such as MySQLCC or the equivalent tool for other databases.

Coding and Debugging: Demonstrated Strength
Coding and debugging is where the strength of Zend Studio lies. It should really make life easier for PHP developers. The first thing that you’ll love is the code completion.

Figure 4 shows code completion in action for the simplest PHP program there is: a one-line phpinfo() call. Simply typing ‘phpi‘ calls this beauty up, and not only can you get a code completion but also a brief help snippet on the selected function. No more thumbing through manuals or testing for bugs when you are trying to remember if you should be using mysql_select_rows or mysql_selectrows!

Figure 4. Completion Elation: The code completion feature is worth the cost of the IDE all on its own.

One thing that could be improved is the breadth of what is available from these dropdowns. So if, for example, you don’t have the MySQL libraries enabled in your instance of PHP they’ll still appear on the list as soon as you type ‘my‘. For PHP extensions that aren’t enabled by default (in your PHP.INI file), such as ‘ImageJpeg‘, this can be both misleading and annoying. If you make an ImageJpeg command in a PHP file, the inline help and autocomplete will register it and encourage you to use it, but when you run, you get an error due to a call to an undefined function. It would be nice if the mini help (see Figure 4) would tell you the extension that is needed to run it or perhaps only give you what is available to you based on your preferences defined in php.ini.

Zend Studio’s debugging is really nice. Just as with any other major IDE, you can now set breakpoints and watches on your PHP. This alone is worth the price of the IDE, as I don’t know how many hours I have spent debugging an application with endless echo($var) commands until I had sorted out a bug. Not only that, but Zend comes with a debug server that you can deploy your page to and if it is called by an external source, it will jump into your IDE in debug mode. Anybody who has ever coded a PayPal IPN site will understand the joy that this will bring you!

Author’s Note: With PayPal IPN, whenever a payment goes in our out of your site, PayPal posts data to a page that you specify. Because you don’t explicitly run this page yourself, it is very difficult to debug.

The only gripe I have with debugging is that the default Debug Output window outputs raw text or HTML code (see Figure 5) rather than rendered previews. When developing Web sites it’s not very intuitive to see just the raw HTML. You can right-click on this output and select to view it in a browser, but it would be a whole lot nicer if there were an HTML rendering engine built into the IDE so that you could see it inline.


Figure 5. Debugging Output. The output would be nicer if there were a preview instead of raw code.
 
Figure 6. Smart GoTo Source: Fast access to an element’s declaration is a surprising bonus feature.

A great feature is the new ‘Smart Goto Source’ (see Figure 6). It allows you to go to a declaration of a variable, class, function, or element. If you hover over the element, hold control, and click on the element you are taken straight to its declaration. Anybody who remembers the ‘browse database’ functionality from old C++ IDEs will know how useful this can be.

However, a problem occurs if the element is declared in another file. If that file isn’t loaded into the IDE you can’t use Smart GoTo to get it. For example, if you declare the function ‘AddIt‘ in one file, and used an include statement to call that file in your application, then Smart Goto (and code complete) will not recognize the AddIt function. There is a way around this: If you are using include files, you can use SmartGoto to load that file. In other words, if you have a statement include(“addit.php”); in your code, you can hover over the file name and CTRL-Click. The IDE will load addit.php and make everything in it available for Smart Goto Source and code completion.

Development Assistance: Mixed Bag
One thing sorely missing is a set of New Project wizards where you have boilerplate applications premade for you. It would be nice to have a ‘New Data Access Web Site’ project or the like where you specify the database and the code to connect to that database is prewritten for you. As it stands, you simply create empty projects and it’s up to you to do what you want with them.

One thing that is nice is the inclusion of a large library of code snippets, and there are some great snippets included, in many different categories from database access to security to games. It’s a wonderful library, but not perfect; I encountered two problems. First, there is no search. You manually browse through the library, which is very large! Secondly you browse through the library only to find that many of the snippets aren’t snippets at all, but in fact references to where you can download the snippet! Worse is that the IDE cannot distinguish these, so you can insert them, but all you end up doing is putting an FTP command into your current code window! It seems to me that the IDE should distinguish between available code and code that must be downloaded.

Code Analysis is a nice feature that gives you another pair of eyes to look over your code, giving you advice on areas where it may not be optimized. Of course its feedback has sometimes to be taken with a grain of salt, as some things that you may think are perfectly OK?such as an assignment within a condition (i.e. while($file=readdir($handle)) )?get reported.

Figure 7. Extra Pair of Eyes: Finding potential security holes in your app with the code analyzer.

An additional annoyance is that it doesn’t allow you to acknowledge one line (or a class of issues) and move on. Each and every time you run an analysis, the same issues are returned, whether or not you’d prefer specific items to be suppressed. However, a really welcome thing is that a mini-help is given with suggestions on how to improve your code when the analyzer does find something (see Figure 7). For beginners this is an amazingly useful learning tool.

A final nit with the development environment is in its overall appearance. Compared to really nice IDEs such as WebLogic Workshop 8.1 or Visual Studio.NET, Zend Studio looks a little rough around the edges. Non-standard and unintuitive icons make it less user-friendly than it could be (for example: for many years the ‘floppy disk’ icon has represented ‘save’?in Zend it is a blocky yellow folder with a blurry green arrow pointing at it), and the color scheme is a little gaudy. Developers have to spend many long hours staring at their IDE, and good choices in colors, fonts and icons go a long way to make the experience a little less painful. Zend needs to catch up a little here.

Some examples of the icons are shown in Table 1.

Save

Undo

Preferences (Isn’t this a calendar?)

Help

Other Great Features
There are too many great features about this IDE for them to all be covered in this review, but another few notables that should be of interest:

  • CVS Integration. Zend integrates neatly with the CVS source control system, a must for any team development environment. It comes with diff tools that allow you to compare versions of files to see what’s been changed.
  • Project Deployment. It has an integrated FTP client that allows you to FTP, SFTP, or FTP over SSh so that you can upload and debug your hard work.
  • Document Generation. PHPDocumentor has been integrated into the IDE to provide easy generation of PHPDocs directly from your development environment.
  • Overall Development
    Development isn’t just about coding and debugging. It’s also about deployment, monitoring, and profiling. Zend offers the complete package for this, of which the IDE is but one component. Announced earlier this month, Zend Platform gives performance statistics for the server on which your application is running, giving you a great way to stress test and stage your application prior to production and to monitor it afterwards.

    In addition, Zend has tools for encoding (and therefore protecting) your code, code optimizers, and many more, all of which can be integrated at the IDE. Finally, they are working on new testing tools to allow white box testing of your completed applications, which will again integrate neatly with the IDE. Zend, a major contributor to PHP5, is offering the full gamut of what an enterprise needs for PHP. It’s a compelling story.

    Zend Studio is a very good IDE that, due to a number of small annoyances, falls a bit short of greatness. Making the database integration more powerful, adding more code generation, and making certain tools such as the code analyzer more user-friendly will make this a product to watch. With more PHP converts who need an easy-to-use, wizard-based IDE emerging each day, this product’s evolution is sure to continue. If you are seriously developing in PHP, Zend Studio, despite its drawbacks, is close to a must-have.

    devxblackblue

    About Our Editorial Process

    At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

    See our full editorial policy.

    About Our Journalist