Manual Encoding

This is optional when you prefer to configure and encode projects manually using an XML file, without using the Zend Guard User Interface, or automating encoding for your project(s), or using a headless server with CLI commands only.


You must prepare an XML file as the input parameter to the GuardEngine command. This file must contain all required input information in order to properly encode and obfuscate your project.

Usage is as follows:

GuardEngine --xml-file <xml-file-path> [--export-candidates <target-file> <path1> [path2] ...]

Encoding External code using the XML File

As we mentioned earlier, the XML output generated by the Zend Guard, can be used to encode files with the command line on this or on another machine.



Instructions on how to complete a procedure

To Encode using the command line (and the XML File):

  1. Create the XML file.

  2. If you are encoding on a remote machine, transfer the XML file and your exclude list file to the machine.

  3. Verify last modifications to the Guard XML parameters file. Most importantly, verify that all resources for PHP / other files and output directory used in the XML are accessible for the user who executes GuardEngine on the filesystem.

  4. Run 'GuardEngine -- XML-FILE <Path to XML File> [extra command parameters like exclude list here]'


The settings defined in the file will be applied to the PHP code, including input and output directory locations. Therefore, you may want to manually edit the file if it is on a different machine to define the different file locations.


The entire schema containing all parameters and format is included in the file: Guard.xsd. This file is located in the Zend Guard installation folder.

Exit Codes

The following table lists GuardEngine exit codes and their descriptions, for automation purposes and general understanding.


Code Description
0 Encoding completed successfully (status "OK")
98 I5 license was found
99 Guard License isn't found (Trial Mode)
100 Execution Complete (another status "OK")
101 Bad command line options
102 Invalid command
103 Source path doesn't exist or not found
104 Unable to locate a handler an XML element
105 Unable to handle an XML element - project options
106 Unable to handle an XML element - source options.
107 PHP version was not specified in the XML
108 Invalid encoding options
109 Unable to add source file for encoding
110 Unexpected CDATA in the XML
111 System TEMP directory not available or not found
112 Cannot create a temp file in the TEMP directory
113 Unable to write to temp file
114 Un-supported PHP version provided for encoding
115 XML parse warning
116 XML parse error
117 XML parse fatal error
118 Unknown optimization level in the XML
119 Unable to write export file content to temp file
120 Unable to find a CMD switch for XML element
121 Error while analyzing XML CDATA
122 The target directory is a sub directory of a source
123 Unable to load encoding library
124 A "new" operator has returned null
125 An exception from the xerces XML
126 An exception from the xerces parser
127 Target directory normalization failed
128 Target directory appears to be invalid
129 Invalid path was specified for export candidates
130 The target directory is a parent directory of a source
131 Failed to create normalized target directory
132 Cyclic definition in the global variables