zendenc and zendenc5

This section serves as a technical reference to the zendenc and zendenc5 commands.

Command Description

Command

zendenc + zendenc5

Synopsis

Command-line function for encoding files.

Syntax 1

zendenc [options] SourceInputPath [EncodedOutputPath]

Arguments

SourceInputPath

The path and/or file name of the source directory or file. This must be a valid full or relative path. This is a mandatory argument for all encoding operations. The command line syntax requires the SourceInputPath parameter precede the EncodedOutputPath parameter.

EncodedOutputPath

The path and/or file name of the target file name where the encoded file is written. This must be a valid full or relative path. This argument is not required for encoding operations using the --delete-source and --rename-source options.

The command line syntax requires the EncodedOutputPath parameter (when used) is entered following the SourceInputPath parameter.

--optionx [option_parameterx]

Various options can be entered to control the functionality of zendenc.

Options may have parameters that immediately follow the option. Every option must be preceded by a double dash -- prefix

Command Option - Syntax

Syntax

Description

--optimizations opt_mask

Optimization mask. (default value: [+++++++])

opt_mask is an integer representing a bit-mask.

The default value enables all of the optimization passes.

Each optimization pass of the Zend Optimizer can be turned on or off based on the mask entered.

--encoded-only

Force cooperation with other encoded files only. This option generates files that work exclusively with associated encoded files. Associated encoded files are those generated by the same company. Files that do not share the same encoded company association cannot call these files.

--asp-tags on/off

Turn ASP tag (”r;<%” ) recognition on/off. (default: off). On or off must be specified as an argument when using this option.

The default, when this option is not used in the command-line, is - off.

--short-tags on/off

Turns short PHP tag (”r;<?” ) recognition either on or off.

On or off must be specified as an argument when using this option.

The default, when option is not used in the command-line, is - on.

--no-header

Disables the PHP-compatible header that is added to the top of every encoded file by default. Encoded files generated with this option will not display a meaningful error when loaded by PHP that doesn't have the Zend Optimizer properly installed. Using this option saves approximately 1.5KB for every encoded file. Do not use it unless disk space constraints are critical.

--prolog-filename <file>

Embed the information in the specified file into the header of the encoded file (overrides --no-header)

--delete-source

Permanently deletes (see warning below) the original source files specified in the SourceInputPath and saves the encoded files in its place.

This option has no option parameter.

When this option is use, do not use the output_file parameter.

Warning:

To avoid permanent loss of non-encoded scripts, make a backup. Deleted files cannot be restored or recovered and will be permanently deleted with this option. If you are unsure about deleting the source files, use the ––rename-source option instead.

--rename-source <ext>

Move the original source file to <input_file>.<ext> and save the encoded file in its place. The output_file parameter should not be specified when using this option.

--recursive

Encode files in directories, recursively. input_file and output_file are the source and target directory names.

--php-only

In recursive mode, don't copy non-PHP files from the source to the target.

--ignore-file-modes

Do not preserve ownership, permissions and timestamps for encoded files (preserved by default).

--include-ext <ext>

Encode files with this extension in recursive mode. By default, the following extensions are encoded: inc php ihtml php3 php4.

This option can be entered more than once to include multiple files.

ext is the file extension of the files, which will be included in the encoding source files.

--exclude-ext <ext>

Used in conjunction with the --recursive option to remove file extensions from the default extensions This option can be entered more than once to exclude multiple files.

ext is the file extension of the files, which will be excluded from the encoding source files.

Don't encode files with this extension in recursive mode.

--exclude-file <name>

Don't encode this file in recursive mode. File should be FULL PATH !!!

--no-default-extensions

Don't automatically use the predefined extensions. Only extensions added with --include-ext will be encoded.

--ignore <pattern>

Files matching this pattern will be ignored in recursive mode.  Default pattern list: [empty]

This option can be entered more than once for ignoring multiple files and can be used to ignore a subfolder by specifying the full path in recursive mode.

--ignore-errors

Continue encoding additional files even if encoding one of the files fails in recursive mode.

Used when encoding multiple files. If an encoding error occurs while encoding a file, the Zend Guard continues processing the other files.

--quiet

Reports names and errors only. Does not report the progress of the encoding or messages other than errors.

This option does not have an option parameter.

--silent

Reports errors only. Does not report names, progress, or messages other than errors.

This option does not have an option parameter.

--force-encode

Allow encoding previously encoded files. (NOT recommended!)

--expires <yyyy-mm-dd>

Make an encoded file to expire on the given date. Date is in yyyy-mm-dd format.

--license-product <name>

Encodes files to only work with a valid license for the ProductName specified (encoded into a signature). ProductName must exactly match the Product Name entered when generating a license.

This is the same as the License file restriction setting.

--sign-product <name>

Encode files with the product name signature. Same as the Support Licensing feature, which works with the Zend Guard API function to identify if a valid license exists. (Scripts check for this signature.)

ProductName must exactly match the Product Name entered when generating a license.

--use-crypto

Cryptographically sign scripts to prevent unauthorized modification.

--obfuscation-level <lvl>

Set the default obfuscation level. The default is 0 - no obfuscation

--export-list <file>

The file that holds the function obfuscation export list. (The file format is one function name per line)

--export-candidates <file>

Create list of functions recommended for exporting in this file.

--export-php

Automatically export all internal (PHP) functions.

--help

Displays help about encoding options.

This option is entered as follows:

zendenc --help

--symlinks

Copy symlinks as symlinks, do not try to resolve them.

--private-key <file>

encodes files with the private key in <file> The file should look like: Company-Key = <private key>

--obfuscate-stats Obfuscation statistics

Result is like 1/16 3/15 1/1 3/15. The groups are: variables functions classes methods. Each group has form of X/Y, where Y is the total count of these entities, and X is how many of them were not obfuscated. For variables, it means how many of the functions were not obfuscate, i.e. 1/16 means that 1 of 16functions were not obfuscated with level 1. For others, it means how many names weren't obfuscated - i.e. 3/15 means 3 of 15 functions, 1/1 means 1 of 1 classes and 3/15 means 3 of 15 methods (Note - functions include methods).

 

 

Related links

Related Links:
Command Line

zendenc - Command Line Examples

Creating a Signature License (Command Line)

zendenc_sign – Command