安装Zend Guard Loader

ZendOptimizer已经不支持php 5.3.x了,本文将介绍如何在php 5.3.x中安装:Zend Guard Loader

下载Zend Guard Loader

Zend 官网:http://www.zend.com/en/products/guard/downloads

找到64位版本,也许您的是32位

安装Zend Guard Loader

下载可能需要注册一个账号。解压后,把里面的so文件上传的服务器中。

在安装前可以先阅读下README文件:

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.

安装Zend Guard Loader

#将so文件复制到php的module文件夹中
#自行把so文件弄到服务器上,如果是32位系统,则目标路径为/usr/lib/php/modules

cp /opt/ZendGuardLoader.so /usr/lib64/php/modules/

#更改文件权限为755

chmod 775 /usr/lib64/php/modules/ZendGuardLoader.so

#配置php,这里我选择在/etc/php.d下创建一个ini文件,也可以直接在php.ini中写

vim /etc/php.d/zendgl.ini

#内容为:
zend_extension=/usr/lib64/php/modules/ZendGuardLoader.so

#重启web服务
service httpd restart

重启后,使用:php -v 命令查看是否成功&使用phpinfo,如果能看到类似,说明就成功了:

注意,当SeLinux开启的时候,上述信息也许就看不到了,无法加载了,这是就需要在SeLinux开启权限。

当然如果您不需要SeLinux,可以把它关闭(具体方法自行search),现在看看我是如何解决Selinux权限问题的。

#安装setroubleshoot包,可以将因selinux权限问题发生的err写入日志文件(/var/log/messages),便于发现问题
yum install setroubleshoot*

#安装完成后,重启auditd服务(setroubleshoot集成到了auditd服务中)
service restart auditd

#接着我们就要观察/var/log/message中的信息了
cat /var/log/messages | grep setroubleshoot

#可以看到下列信息:
Jan 27 17:01:42 localhost setroubleshoot:
SELinux is preventing /usr/sbin/httpd from using the execstack access on a process. 
For complete SELinux messages. run sealert -l a89898c7-12e5-4e3e-a186-df18818df43f

#提示我们可以运行sealert -l a89898c7-12e5-4e3e-a186-df18818df43f查看详细信息
sealert -l a89898c7-12e5-4e3e-a186-df18818df43f

#显示内容如下图
安装Zend Guard Loader

很轻松的知道了,该如何解决了,,运行:

setsebool -P httpd_execmem 1

再次重启httpd,检查zendguardloader是否被加载!

你可能感兴趣的:(安装Zend Guard Loader)