Encoding Projects Using Zend Guard

This procedure describes how to open your Zend Studio Projects in Zend Guard in order to encode them.


Zend Guard must be configured in Zend Studio before Zend Guard integration is accessible. This can be configured through the Zend Guard preferences page, accessible from Window | Preferences | PHP | Zend Guard.



Instructions on how to complete a procedure

To open a project in Zend Guard:

  1. In PHP Explorer view, right-click the required project and select Encode Project -or- select the required project and from the Menu Bar go to Project | Encode Project -or- click the Encode Project button on the toolbar.
    If you have not configured your Zend Guard location in Zend Studio , a prompt will appear stating that Zend Guard preferences have not been defined. Click on the 'Define Zend Guard.exe' link to be taken to the Zend Guard preferences page or go to Window | Preferences | PHP | Zend Guard.
    If you have defined your Zend Guard location, Zend Guard will now be opened and a Zend Guard Project dialog will open.

Zend Guard Project creation dialog

  1. Enter the following information in the relevant fields:

  • Project Name - This will automatically be taken from the name of your Zend Studio project.
    This cannot be the same name as an existing project in Guard.

  • Project contents - The directory into which the project will be placed. Unmark to browse to a different location.

  • Product Name - Enter the product's name.

  • Product Version - Enter the product's version.

  • Output Location - Enter the location to which you would like the encoded files to be created.

  1. Click Next.

  2. If you want additional files and folders to be added to the project, click Add Folder or Add File and browse to the required source.

  3. Click Next.

  4. Select:

  • The PHP version

  • Whether to enable Short Tag Support - Enable recognition of short PHP tags. Recognizes <? as a valid PHP start tag. When this option is not selected, Zend Guard will not encode short tags, which will be treated as regular HTML.

  • Whether to enable ASP Tag Support - Enables recognition of ASP tags. Recognizes <% as a valid PHP start tag. When not selected, code within ASP tags is treated as regular HTML.

  • Resolve Symlinks - Resolves Symbolic Links before encoding (not applicable in Windows). A symbolic link (often shortened to symlink and also known as a soft link) consists of a special type of file that serves as a reference to another file or directory. Unix-like operating systems in particular often feature symbolic links.

  • Which files to encode - Lists the file extensions for Guard to encode (extensions not listed will not be encoded). File extensions that are not listed here and in "Patterns to Ignore" will be sent as-is to the output folder.

  • Which patterns to ignore - Files matching these patterns will not be encoded when encoding a directory, nor will they be copied as-is to the target directory. By default, the list contains the CVS directory and cvsignore files (includes Wildcards '*').

  1. Click Finish.

Your project will be opened in Zend Guard and can be encoded using Zend Guard's functionality.

Zend Guard


Your production server must be running the Zend Optimizer in order for your PHP to be able to run the files encoded by Zend Guard. The Zend Optimizer comes bundled with Zend Server  or can be downloaded from the Zend Guard product page (http://www.zend.com/en/products/guard/optimizer).


Always test encoded files before uploading them to your production server.