Материал: Zend_Optimizer_User_Guide

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

Configure

Optimizer

Settings

Zend OptimizerTM User Guide

Zend Optimizer Settings

As mentioned earlier the Zend Optimizer goes over the intermediate code generated by the standard Zend run-time compiler and optimizes it for faster execution.

In order to customize the Optimizers performance, the following directives and extensions have been provided.

Directive

Description

zend_optimizer.enable_loader

If you do not plan to use the Zend Optimizer

 

to load encoded files, you can slightly

 

improve the Optimizer’s performance by

 

adding the zend_optimizer.enable_loader =

 

0. This disables the transparent auto-

 

loading mechanism that is built into the Zend

 

Optimizer.

zend_optimizer.disable_licensing

If you do not need to use any licensing

 

features, you can disable the Zend Optimizer

 

license request. Setting this option lowers

 

Optimizer memory usage and slightly

 

enhances performance

zend_optimizer.licence_path

A license file is required to load encoded

 

PHP scripts that were encoded with a

 

“license” option.

 

If you turn off this option, the encoded scripts

 

on your server that require a license may not

 

load.

 

This directive is a list of directories or files,

 

separated by path separator (; on windows,:

 

on Unix) that gives the Optimizer a place to

 

look for encoded file licenses.

 

When directories are added to this path, all

 

files ending in .zl will be loaded as licenses.

 

If the file that was added to this path, was

 

loaded as a license.

 

Licenses are loaded on server start time

 

(unless loaded by PHP API), so if you add a

 

license or change a path, you should restart

 

the server.

zend_optimizer.obfuscation_level_support

The Obfuscation level supported by

 

Optimizer.

Located in the zend.ini, these directives can be easily configured through Zend Platform and Zend Core (all flavors).

Note:

If you are using the Zend Optimizer along with Zend Guard to encode files, please refer to the Zend Guard User Guide for more information.

8

Zend OptimizerTM User Guide

Zend Optimizer PHP API Functions

The following table lists the PHP API functions that can be used with the Zend Optimizer.

9

Zend OptimizerTM User Guide

Function

zend_loader_enabled

zend_loader_file_encoded

zend_loader_file_licensed

zend_loader_current_file

zend_loader_install_license

obfuscate_function_name

Syntax

bool zend_loader_enabled()

bool zend_loader_file_encoded()

array zend_loader_file_licensed()

string zend_loader_current_file()

bool zend_loader_install_license(string license_file[, bool override])

string obfuscate_function_name(string function_name)

current_obfuscation_level

int current_obfuscation_level()

Note:

Description

Shown if loader is enabled.

Returns true if the current file is a Zendencoded file.

Returns license (array with fields) if the current file has a valid license and is encoded, otherwise it returns false.

Returns the name of the file currently being executed.

Dynamically loads a license for applications encoded with ZendGuard. The Override controls if it will override old licenses for the same product.

Obfuscate and return the given function name with the internal obfuscation function.

Returns the current run-time obfuscation level.

Toinsurebackward compatability with scripts obfuscated with the Zend Guard at level Basic , their run-time obfuscation level will remain 0 !

 

 

zend_runtime_obfuscate

bool zend_runtime_obfuscate()

zend_get_id

array zend_get_id([bool all_ids =

 

false])

10

Start runtimeobfuscation support that allows limited mixing of obfuscated and un-obfuscated code.

Returns array of the host ids. If all_ids is true, then all IDs are returned, otherwise only IDs considered "primary" are returned.

Zend OptimizerTM User Guide

Getting Additional Information

There are several sources of information that Zend Optimizer users can in order to find answers to questions that may be raised.

Answers to technical and operating system related questions can be found in the Zend Knowledge Base. Here you will find a repository of articles that address know issues and how to deal with them: http://www.zend.com/support/knowledgebase.php

Otherwise, you can access one of the Zend forums:

http://www.zend.com/support/

For issues other than technical support, email us at: support@zend.com

11

Zend OptimizerTM User Guide

Zend Optimizer Technical FAQ

What is the Zend Optimizer? What does it do?

The Zend Optimizer goes over the intermediate code generated by the standard Zend run-time compiler and optimizes it for faster execution. In addition, the Zend Optimizer enables PHP to load and execute files encoded by the ZendGuardTM.

How do I get the Zend Optimizer?

The Zend Optimizer is available for download free of charge from the Zend Store, at http://www.zend.com/store/.

I have installed the Zend Optimizer. How do I start it?

The Zend Optimizer is a passive module that runs within the framework of PHP. It optimizes scripts automatically, and transparently detects and loads encoded files, therefore there is no need for you to start it.

How many optimizations does the Zend Optimizer perform altogether?

The Zend Optimizer is capable of performing around 20 different optimizations, some of which are quite complex. One of the simpler optimizations that the Zend Optimizer does is to change post-incrementing to pre-incrementing, where possible, since pre-incrementing is the faster operation of the two.

Is there any way to further improve the performance of the Optimizer?

If you dont plan to use the Zend Optimizer in order to load encoded files, you can slightly improve the performance of the Optimizer by adding the

directive to . This disables the transparentze d optimizerauto-loading.enablemechanismloader that= 0 is built into thephpZend.i i Optimizer.

Can encoded and non-encoded (source) PHP files be used together?

Encoded and non-encoded PHP files can be used together transparently.

Will using encoded files (instead of source files) change run-time speed or file size?

There might be some speed gain because the compilation stage is saved on every run of the script, however, speed improvements, if any, are dependent on the nature of the script. The size of an encoded file might be somewhat smaller or larger than the source file, but this too is dependent on the nature of the script. The factors that tend to improve run-time speed are not necessarily the same as those that tend to decrease file size.

When I start my server, the Zend Optimizer gives error messages and fails: Why?

Your version of PHP may be incompatible with the Zend Optimizer that you installed. Make sure that you download a version of the Zend Optimizer that is compatible with your version of PHP.

When I try to run an encoded file, error messages are displayed: Why?

The most common cause of error messages and failure is incompatibility either with the PHP version, or with the Zend Intermediate Code file (that is, with the version of the Zend Guard that encoded the file).

Another possible cause for failure could be encoded file corruption caused by transferring the file between systems. This happens because even though encoded

12