You are on page 1of 4

Zend Optimizer Page 1 of 4

Zend Optimizer™
User Guide

Scope
The Zend Optimizer boosts PHP performance by going over the intermediate code
generated by the standard Zend run-time compiler and optimizing it for faster execution.
In addition, it enables PHP installations to read Zend Intermediate Code files that were
encoded by the Zend Encoder™ (zendenc).
The Zend Optimizer is available for free at the Zend Store, at
http://www.zend.com/store/.
The Zend Optimizer supports the following platforms:
- Solaris®/sparc 2.6 or later
- Linux® (i386/glibc 2.1 and libc5)
- FreeBSD 3.4 or later
- Microsoft® Windows® NT 4.0, Windows 2000 and Windows XP
In addition, the Zend also provides unsupported builds of the Zend Optimizer for the
following platforms:
- Mac OSX
- OpenBSD
- Solaris/x86 2.6 or later
This guide consists of the following main sections:
• “System Requirements,” page 1
• “Installation,” page 2
• “Avoiding Incompatibilities,” page 4
• “Support,” page 4

System Requirements
The Zend Optimizer has no special system requirements, except that a compatible version
of PHP 4.x must be installed. For additional information, see “Avoiding
Incompatibilities,” page 4 or review our Product Compatibility Table
(http://www.zend.com/store/products/product_ compatibility.php).

Zend Technologies Ltd., www.zend.com


Zend Optimizer Page 2 of 4

Installation

It is recommended that after installing the Zend Optimizer you check that the installation
was successful (see “Checking for Successful Installation,” page 4).
After installation, the Zend Optimizer runs within the framework of PHP. It optimizes
your PHP scripts automatically, and transparently detects and loads encoded files.

UNIX (Linux, Solaris, FreeBSD)

To install the Zend Optimizer under UNIX


1. Execute the following command (and follow the instructions):
./install.sh

Note: Be sure to download the Zend Optimizer version that corresponds with the
PHP version that you choose to compile. For example, the Zend Optimizer for
PHP 4.0.4 will only function with PHP 4.0.4. Otherwise, the Zend Optimizer
will not load and an error message will be displayed.

2. If you are running under Apache, restart your Apache Web server. For recent
Apache 1.3 versions, use the commands:

apachectl stop; apachectl start

Mac OSX, OpenBSD, Solaris/x86

To install the Zend Optimizer under these platforms


1. Unpack the package file by running the command

gunzip -c <package name> | tar xvf -

The unzipped files will be placed in a directory with the same name as the package
but without the .tar.gz suffix.

Copy the ZendOptimizer.so file to your system; a good place to put it is in the
directory /usr/local/Zend/lib.

2. Mac OSX only:


Copy the php binary to your system. A good place to put it is in the directory
/usr/local/Zend/bin.
Copy the libphp4.so file to your system. A good place to put it is in the directory
/usr/local/Zend/lib

Zend Technologies Ltd., www.zend.com


Zend Optimizer Page 3 of 4

3. Add the following lines to your php.ini file (usually at /usr/local/lib); do not add
any extra spaces or tabs:

zend_optimizer.optimization_level=15
zend_extension="/usr/local/Zend/lib/ZendOptimizer.so"

Note: If you do not plan on executing encoded files, disable the Optimizer's
loading feature by adding:

zend_optimizer.enable_loader = 0

to your php.ini. This will hasten file execution even further.

4. Mac OSX only:

Since the system’s default php and libphp.so binaries do no support dynamic
extensions, you must replace your system’s own php and libphp.so with the ones
provided in he package by executing the following commands:

mv /usr/libexec/httpd/libphp4.so /usr/libexec/httpd/libphp4.so.org
ln -s /usr/local/Zend/lib/libphp4.so /usr/libexec/httpd/libphp4.so
mv /usr/bin/php /usr/bin/php.org
ln -s /usr/local/Zend/bin/php /usr/bin/php

5. Restart your Web server.


If you are running under Apache recent 1.3 versions, use the commands apachectl
stop; apachectl start.

Windows

To install the Zend Optimizer under Windows


1. To ensure that your PHP installation is compatible with the Zend Optimizer, it is
recommended to use the Windows packages posted at the Zend Store, at
http://www.zend.com/store/. These are always compiled in non-debug mode, and
the Zend Optimizer will work only with non-debug PHP binaries.
2. The Zend Optimizer for Windows package is a self-extracting installer. Simply run
the package file, and follow the installation instructions.
Note: Be sure to download the Zend Optimizer version that corresponds with the PHP
version that you choose to compile. For example, the Zend Optimizer module for
PHP 4.0.4 will only function with PHP 4.0.4. Otherwise, the Zend Optimizer will
not load and an error message will be displayed.
3. If you are running a server module (e.g. ISAPI), restart your server. For Microsoft
IIS, run net stop iisadmin, and then net start w3svc, from a command line console.

Zend Technologies Ltd., www.zend.com


Zend Optimizer Page 4 of 4

Checking for Successful Installation


Use the PHP function phpinfo() to check for successful installation, as shown in the
following script:
<?php
phpinfo();
?>

The part of the output where the Zend Optimizer is listed will look similar to the
following:
This program makes use of the Zend scripting language engine:
Zend Engine vX.Y.Z, copyright (c) 1998-2001, Zend Technologies Ltd.,
with the Zend Optimizer vX.Y.Z, copyright (c) 1998-2001 Zend Technologies Ltd.

Avoiding Incompatibilities
This section discusses two possible incompatibilities that have to be avoided when using
the Zend Optimizer.

Incompatibility with PHP Version


The Zend Optimizer must be compatible with the version of PHP 4 that is installed. An
incompatibility will cause the Zend Optimizer to fail with an error message (located in the
web server’s log file).

Incompatibility with Zend Intermediate Code File


The Zend Intermediate Code file must have been compiled by a version of the Zend
Encoder (zendenc) that is compatible with the version of the Zend Optimizer that is
running the file. Otherwise, the Optimizer will fail with an error message (located in the
log file) such as: Incompatible file format. To check whether the Optimizer and the
Encoder are compatible, refer to the Zend Products Compatibility table, at
http://www.zend.com/store/products/product_compatibility.php.

Support
If you have problems or questions about the Zend Optimizer, you can use the online
Optimizer forum on Zend.com at http://www.zend.com/zend/optimizer-forum.php.
Zend SOS subscribers can also submit questions about setup and installation support
through Zend Support-Online Services (SOS). To access Zend SOS, go to the Pickup
Depot, fill in our convenient form, and click on the "Submit" button. Our worldwide team
of experts will get to work to resolve your problem. Track the status of your incident
anytime through Zend SOS.
For issues other then technical support, please email us at info@zend.com.

Zend Technologies Ltd., www.zend.com

You might also like