Chapter 15. Integrated Zend Tools

As you have seen from the chapters so far in this book, Zend Studio for Eclipse has a lot of functionality built directly into it. It is also designed to work with other Zend products that you might use on a regular basis. Unlike other parts of Zend Studio for Eclipse that we have discussed so far, for the integrated tools to work, you must have a copy of the tool installed on your computer separate from Zend Studio for Eclipse.

Two tools that we look at in this chapter are Zend Guard, which is the PHP encoding, obfuscating, and licensing tool, and Zend Platform, which is an application server. If you don’t have a license for either of these, you can download a trial version from the Zend website so that you can see how they integrate with Zend Studio for Eclipse. This chapter begins on the assumption that you have both of these tools up and running.

Integration with Zend Guard

One of the problems with scripting languages is that they are hard to distribute if you are looking for a way to keep your code safe from prying eyes or manipulation. The answer to this problem is a way to encrypt or compile a PHP script. Of course, this gets even more complicated when you are thinking about running a web page in this way. Zend Guard encodes your scripts and then allows you to choose who can see what and for how long. Let’s look at how to install Zend Guard; then we can use it to encode a simple “Hello World” script.

Zend Guard must be installed on your system for you to be able to encode a file. When Zend Guard is installed, you have to tell Zend Studio for Eclipse where to find ZendGuard.exe. You can do this by selecting Window, Preferences. Then browse to PHP, Zend Guard, as shown in Figure 15.1.

Setting up Zend Guard in Zend Studio for Eclipse.

Figure 15.1. Setting up Zend Guard in Zend Studio for Eclipse.

You also need a free program from Zend called Zend Optimizer installed on your server to run the encoded files. Zend Optimizer installs itself on your server and prepares to read all types of encoded files. When the optimizer is installed and running correctly, encoded files should run like any other PHP files on your system. Although Zend Optimizer installs seamlessly on most servers, if you are running a different server configuration, you may have to check your php.ini file manually. Make sure that the line zend_optimizer.enable_loader is set to 1.

Create a new project in Zend Studio for Eclipse to test Zend Guard. Now add a new file and put in a simple “Hello World” script. If you run this file, you see Hello World printed on the screen (as expected). You may have guessed that this isn’t the exciting part of this example. We are getting to that now.

Open Zend Guard from Zend Studio for Eclipse by right-clicking on your project in the PHP Explorer view and then select Encode Project. Zend Guard launches, and you can import your Zend Studio for Eclipse project so that you can encode it.

In Zend Guard, select File, New Zend Guard Project. In the first project creation dialog, fill in the project information with something similar to the sample in Figure 15.2. Keep in mind that Zend Guard projects must be named differently than Zend Studio for Eclipse projects; otherwise, you get a name conflict. For the Output Location field, select a location that is in the web root of your server (or you can move the encoded files to a web server after they are encoded).

Creating a Zend Guard project.

Figure 15.2. Creating a Zend Guard project.

The second screen of the project creation dialog is the file and folder source selection. Click on the Add Folder button and browse to the Zend Studio for Eclipse project folder in your Zend workspace. The path shown in Figure 15.3 is C:Documents and SettingsIanendworkspacesDefaultWorkspaceHelloWorld, where HelloWorld is the name of the project in Zend Studio for Eclipse.

Selecting project source files for Zend Guard.

Figure 15.3. Selecting project source files for Zend Guard.

After you have selected the source files, you can click Finish, and Zend Studio for Eclipse project files are imported into your Zend Guard project. From here, you can perform several tasks, including creating product license keys, configuring the number of concurrent users allowed on your system, and making other project-specific settings. For this example, let’s do a standard encoding. Select Project, Encode so that Zend Guard encodes the files in your project and puts them in the directory that you defined in the settings. If you browse to the directory where the newly encoded files were put, you see files with the same names as the files in your Zend Studio for Eclipse project, but if you open them, you see garbled characters.

If the file that you encoded is in a web server directory, you can browse to the file, and it should run as a regular unencoded file would. If Zend Optimizer is not configured correctly, you see a screen similar to the one in Figure 15.4 informing you that something is wrong with your installation of the optimizer. If you get this screen, Zend Optimizer may not be installed, you may not have the latest version, or it may be configured incorrectly.

Errors loading a file encoded by Zend Guard.

Figure 15.4. Errors loading a file encoded by Zend Guard.

Integration with Zend Platform

Zend Studio for Eclipse is also integrated with another Zend product. Zend Platform is a PHP production environment that allows you to monitor script execution and server status. If Zend Platform is installed on your computer, you can run it from Zend Studio for Eclipse. This section provides a quick look at some of the features that it offers.

You can run Zend Platform by clicking on the Launch Platform Integration button in the toolbar. You are greeted by the Platform login screen, as shown in Figure 15.5. After successfully logging in, you can browse system events and server status. This is fine, but it is basically just loading a URL inside Zend Studio for Eclipse. There is also a Zend Platform view that allows you to monitor server events in a special view.

Zend Platform login screen in Zend Studio for Eclipse.

Figure 15.5. Zend Platform login screen in Zend Studio for Eclipse.

To open the Zend Platform view, select Window, Show View, Other. The view is in Zend, Platform Events. If you load the view, you see something like what is shown in Figure 15.6. If your view is empty, click on the Retrieve Events from Platform button and then use the view control buttons to cycle through the events and troubleshoot them if necessary.

Platform Events view showing some events.

Figure 15.6. Platform Events view showing some events.

Summary

Zend Guard and Zend Platform are both useful tools that you can access directly from Zend Studio for Eclipse. If you are already a user of the products, you will be happy to see how well they integrate into the IDE.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.138.226