BluRayCD Forum

 找回密码
 立即注册【分享大片】
查看: 645|回复: 0
收起左侧

[交流分享] Linux系统环境下为 PHP 5.3.8 配置 Zend Guard Loader

[复制链接]

5280

主题

222

回帖

4万

积分

Forum Admin

金币
247 枚
体力
18086 点

最高荣誉勋章

kmvodys 发表于 2012-4-6 20:04:42 | 显示全部楼层 |阅读模式
从PHP5.3开始如果要支持ZendGuard加密的PHP代码,必须安装Zend Guard Loader,老的zend optimizer将不被支持。
本文介绍在工作中为Linux安装Zend Guard Loader支持的过程。
操作系统为CentOS5.5,PHP版本为5.3.8(CentOS5.5中的PHP默认版本较低,如果要升级到PHP最新版,可以使用remi的report源进行升级)。

Windows 下面的 Zend Guard Loader 不支持 php5.3.8 VC9 x86 Thread Safe

而,php5.3.8  VC9 x86 Non Thread Safe 又不支持 apache 。

所以安装的话,就需要安装在iis下面。

1.从Zend.com下载最新的Linux操作系统系下的Zend Guard Loader:本文用的是x86-64位的,下载的文件为:ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
2.上传至Linux服务器并解压缩,注意阅读生成目录下的README文件。全文如下(添加必要的注释).
在/etc/php.d/目录下创建文件zend.ini,内容如下:
zend_extension=/usr/lib64/php/modules/ZendGuardLoader.so
注意路径一定要写上,刚开始没写路径,老是加载不上ZendGuardLoader.so
也可以直接将上面的配置写入/etc/php.ini文件中,效果一样。
3.重启httpd服务:service httpd restart。
4.https://IP/test.php(内容为<?php phpinfo(); ?>),看到如下内容及证明安装成功了。



注意:with Zend Guard Loader v3.3出现表示安装成功,如果没有则安装失败。
5.其他的可选配置,可以参考下面的README文件。

1. Extract the Zend Loader package.解压缩
2. Locate and extract the ZendGuardLoader.so (Linux) or ZendLoader.dll (Windows) that corresponds to your php version.确定ZendGuardLoader.so 的位置,为了方便本人将其放在了PHP的模块默认位置:/usr/lib64/php/modules
3. Add the following line to your php.ini file for loading the ZendGuardLoader:在php.ini文件中添加指令(注意要协商完整路径,否则无法加载)
   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    可以不用加下面的,因为默认是enable的。
  ; 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.

以下是操作的shell片段:

第一步,通过探针或者PHPinfo查询到当前加载的php.ini
  1. Loaded Configuration File:/etc/php5/apache2/php.ini
复制代码
第二步,下载扩展
  1. wget https://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
复制代码
Windows下为
  1. https://downloads.zend.com/guard/5.1.0EA/ZendGuardLoader-php-5.3-Windows.zip
复制代码
第三步,解压,提取ZendGuardLoader.so,Windows下叫ZendLoader.dll,放到PHP的ext目录下(推荐,不是必须)
第四步,编辑php.ini,添加相关配置信息
  1. vi /etc/php5/apache2/php.ini
  2. zend_extension=/usr/local/zend/ZendGuardLoader.so
复制代码
或者
  1.     [Zend.loader]
  2.     zend_loader.enable=1
  3.     zend_loader.disable_licensing=1
  4.     zend_loader.obfuscation_level_support=3
  5.     zend_loader.license_path=
  6.     zend_extension="c:\php\ext\ZendLoader.dll"
复制代码
最后,重启Webserver OK搞定收工。

本版积分规则

小黑屋|手机版|Archiver|4K蓝光论坛

GMT+8, 2024-4-29 02:37

Copyright © 2001-2021, Gadaddy Cloud.

快速回复 返回顶部 返回列表