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.
To Encode using the command line (and the XML File):
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.
The following table lists GuardEngine exit codes and their descriptions, for automation purposes and general understanding.
|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|
|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|