PHP 5.3 Zend Optimizer Replaced by the New Zend Guard Loader

1. Download the Zend Guard Loader package.
(Official download link: http://www.zend.com/en/products/guard/downloads)

2. Extract and locate ZendGuardLoader.so (Linux) or ZendLoader.dll (Windows) corresponding to your PHP version.
 
3. Add the following line to your php.ini file to load Zend Guard Loader:
    Linux and Mac OS X: zend_extension = <full_path_to_ZendGuardLoader.so>
    Windows (non-thread-safe):  zend_extension = <full_path_to_ZendLoader.dll>
 
4. Add an additional line in php.ini to enable Zend Guard Loader:
    zend_loader.enable = 1
 
5. Optional: Add the following lines to the Zend Guard Loader configuration section in your php.ini file:
    ;Disable license checks (for performance reasons)
    zend_loader.disable_licensing = 0
    ;Enable obfuscation level support. Levels are detailed in the official Zend Guard documentation. 0 – Obfuscation disabled
    zend_loader.obfuscation_level_support = 3
    ;Path to search for Zend product license files. For more information on creating a license file, refer to the Zend Guard User Guide.
    zend_loader.license_path =
 
6. If you use Zend Debugger, ensure Zend Guard Loader loads before it.
 
7. If you use ionCube Loader, ensure Zend Guard Loader loads before it.
 
8. Restart your web server.
 
=============================================================
 
Zend Optimizer 3.3 Optimization Configuration Guide
 
Zend Optimizer is a free PHP optimization software developed by Zend Technologies, the creator of the core PHP engine “Zend.” According to Zend, using this software can increase performance by at least 30% in some cases! Such a great freebie is definitely worth using, so now let’s discuss how to configure this software.
       Zend Optimizer’s installation is straightforward; the installation wizard automatically modifies your php.ini based on your selections to enable the engine. Below, we will introduce Zend Optimizer’s configuration options to help you customize the optimal settings. Here is the configuration file I use; don’t worry if you don’t understand it yet—by the end of this article, you will.
 
[Zend]
zend_optimizer.optimization_level=1023
zend_optimizer.encoder_loader=0
zend_extension_ts="C:Program FilesZendlibZendOptimizer.dll"
 
Now let’s explain what this configuration file means:
zend_optimizer.optimization_level 《== Optimization level, defining how many optimization passes to activate.
zend_optimizer.encoder_loader    《== Whether to allow processing of PHP files encrypted by Zend Encoder.
zend_extension_ts                        《== Directory where the optimizer is located.
 
 Detailed Explanation of Optimization Passes for zend_optimizer.optimization_level
       This is the most critical part, read carefully! ZendOpt has a total of 10 optimization passes. In theory, the more passes enabled, the better the performance. Of course, theory and practice always diverge. Enabling more optimization processes also consumes relatively more system resources. The 10 optimization passes of ZendOpt are not equal in effect. The highest value (High mode) defined by Zend is 15, which means enabling passes 1 through 4. Naturally, many users are not satisfied with this, as it enables only 4 passes, not even half the total. The corresponding numeric codes (values) for each optimization pass are as follows:
       None      0  <= In this case, better not to install it, save some memory instead!
       Pass 1 (PASS1)  1
       Pass 2 (PASS2)  2
       Pass 3 (PASS3)  4
       Pass 4 (PASS4)  8
       Pass 5 (PASS5)  16
       Pass 6 (PASS6)  32
       Pass 7 (PASS7)  64
       Pass 8 (PASS8)  128
       Pass 9 (PASS9)  256
       Pass 10 (PASS10)  512
      The way to enable optimization passes is controlled by the sum of these numeric codes (values) as the parameter value. For example, in my configuration file, zend_optimizer.optimization_level = 1023, where 1023 is the sum of all numeric codes from Pass 1 to Pass 10, indicating all 10 passes are enabled. The Zend-defined High mode value of 15 means enabling passes 1 through 4 simultaneously.
       Detailed Explanation of Encoded Code Support: zend_optimizer.encoder_loader
       Many users unfamiliar with the Zend Opt FAQ likely do not know about this parameter. This parameter tells Zend Optimizer whether to support code encrypted by Zend Encoder. By default, ZendOpt supports encrypted code. If you do not use encrypted code, I recommend disabling this option. This feature involves a decoding/unpacking process that increases system load.
       This parameter has only two values: 0 for disabled, 1 for enabled. The default is 1; I recommend setting it to 0.
       Module Location: zend_extension_ts — No explanation needed.
       This is the simplest part; the parameter is the installation path of the Zend Optimizer module on your hard drive.
 
=================================================
 
Installing Zend Optimizer on PHP 5.3
 
Recently, I was configuring a new PHP environment. Since both MySQL and PHP versions needed updating, I used the latest PHP 5.3.6 on the server and downloaded the newest Zend Optimizer version 3.3.3 from Zend. Obviously, after installation, Zend Optimizer failed to load.
 
The reason is that Zend Optimizer 3.3.3 only supports PHP 5.2.x. For PHP 5.3.x, you need Zend Guard Loader 5.5. In other words, Zend will no longer update Zend Optimizer going forward. 
So you install Zend Guard Loader instead. However, Zend Guard Loader 5.5 can only decode code encrypted by Zend Guard 5.5; it is powerless against code encrypted by older versions of Zend Guard. If the Zend product you use was encrypted with Zend Guard 5.5 or higher, congratulations—just install Zend Guard Loader. But if the product’s developer hasn’t been that forward-thinking yet, read on. 
In this day and age, PHP on IIS uses FastCGI mode. FastCGI ingrains the concept that you should use the non-thread-safe (nts) version of PHP. If you pair Zend Optimizer 3.3.3 with a PHP 5.2.x nts version, it fails again, because Zend Optimizer requires the thread-safe version. 
As it stands, the latest compatible version is php-5.2.17-Win32-VC6-x86, available in both msi and zip formats. Following habit, I used the msi installer, but after installing PHP, the page threw FastCGI errors (even before installing Zend). I tried placing php.ini in the PHP directory, in the Windows directory, and in both directories—all resulted in the same errors…… 
Then I uninstalled the PHP msi version and switched to the zip version. With php.ini placed only in the Windows directory and not in the PHP directory, phpinfo() finally displayed “with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies.” 
Subsequently, I successfully installed Zend Optimizer with the thread-safe zip version of PHP 5.2.17 on another server running IIS6+FastCGI. This proves that while this isn’t the only way to install Zend Optimizer on PHP 5.2.x, it is at least a guaranteed method.
Regarding Zend Optimizer installation, download ZendGuardLoader-php-5.3-Windows from the official site. 
After downloading, place the corresponding ZendLoader.dll file and add the appropriate line to php.ini. 
For detailed methods, see 
Zend Guard Loader installation instructions 
——————————————- 
1. Extract the Zend Loader package. 
2. Locate and extract the ZendGuardLoader.so (Linux) or ZendLoader.dll (Windows) that corresponds to your php version. 
3. Add the following line to your php.ini file for loading the ZendGuardLoader: 
   Linux and Mac OS X:      zend_extension=<full_path_to_ZendGuardLoader.so> 
   Windows non-thread safe: zend_extension=<full_path_to_ZendLoader.dll> 
4. Add an aditional line to your php.ini for enabling ZendGuardLoader 
  ; Enables loading encoded scripts. The default value is On 
  zend_loader.enable=1 
5. Optional: following lines can be added your php.ini file for ZendGuardLoader configuration: 
   ; Disable license checks (for performance reasons) 
     zend_loader.disable_licensing=0 
   ; The Obfuscation level supported by Zend Guard Loader. The levels are detailed in the official Zend Guard Documentation. 0 – no obfuscation is enabled 
     zend_loader.obfuscation_level_support=3 
   ; Path to where licensed Zend products should look for the product license. For more information on how to create a license file, see the Zend Guard User Guide 
     zend_loader.license_path= 
6. If you use Zend debugger as well, please make sure to load it after the Zend guard Loader 
7. If you use ioncube loader, please make sure to load it before Zend guard Loader 
8. Restart your Web server.
 
==================================================
 
Windows Version
 
c. PHP5.3.0 (Note: Be sure to download the VC9 Non Thread Safe version for improved performance and reliability)
 
d. FastCGI component for IIS6 (Since PHP 5.3.0, PHP has dropped ISAPI module support on the IIS platform due to long-standing stability issues with PHP+ISAPI. It now only supports FastCGI mode. Download from the official IIS website)
 
=========================================================
 
Quick Guide to Configuring IIS 6.0 PHP FastCGI + Zend Optimizer, WinCache, eAccelerator
 
First, download the PHP package and the FastCGI module.
If you do not need Zend Optimizer, please download the Non Thread Safe version.
http://windows.php.net/downloads/releases/archives/php-5.2.14-nts-Win32-VC6-x86.zip
If you need Zend Optimizer, please download the Thread Safe version of PHP.
http://windows.php.net/downloads/releases/archives/php-5.2.14-Win32-VC6-x86.zip
FastCGI module download: Download the x86 version.
http://www.iis.net/download/fastcgi
Or
http://go.microsoft.com/?linkid=9707432
Note: Microsoft states that FastCGI has higher execution efficiency when using the Non Thread Safe version of PHP, and they recommend it.
However, many commercial programs are encrypted with Zend, so download the PHP package that fits your actual situation.
Extract the downloaded PHP package, copy it to the C drive, rename the folder to PHP, and grant read permissions to iis_wpg.
Then open the PHP folder, find php.ini-dist, copy it, and rename it to php.ini. The location should be c:/php.
Create a session folder and grant write permissions to iis_wpg. For example, mine is C:/phptmp/session.
Open php.ini, find session.save_path, remove the semicolon (;), and modify it to the path of your session folder.
session.save_path = "C:/phptmp/session"
Find extension_dir and modify as follows:
extension_dir = "C:/php/ext"
Modify the FastCGI module parameters:
cgi.force_redirect = 0
cgi.fix_pathinfo= 1
fastcgi.impersonate = 1
Enable PHP extensions by removing the semicolon (;). For example:
Enable them according to your actual application environment.
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_dbase.dll
;extension=php_fdf.dll
extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_ifx.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
extension=php_mbstring.dll
;extension=php_exif.dll
extension=php_mcrypt.dll
extension=php_mhash.dll
;extension=php_mime_magic.dll
;extension=php_ming.dll
;extension=php_msql.dll
;extension=php_mssql.dll
extension=php_mysql.dll
;extension=php_mysqli.dll
;extension=php_oci8.dll
;extension=php_openssl.dll
;extension=php_pdo.dll
;extension=php_pdo_firebird.dll
;extension=php_pdo_mssql.dll
;extension=php_pdo_mysql.dll
;extension=php_pdo_oci.dll
;extension=php_pdo_oci8.dll
;extension=php_pdo_odbc.dll
;extension=php_pdo_pgsql.dll
;extension=php_pdo_sqlite.dll
;extension=php_pgsql.dll
;extension=php_pspell.dll
;extension=php_shmop.dll
;extension=php_snmp.dll
;extension=php_soap.dll
;extension=php_sockets.dll
;extension=php_sqlite.dll
;extension=php_sybase_ct.dll
;extension=php_tidy.dll
;extension=php_xmlrpc.dll

Leave a Comment

Your email address will not be published.