简洁的想法

仁爱、喜乐、和平、忍耐、恩慈、良善、信实、温柔、节制

PHP 5.3.3 | ZendOptimizer | Zend Guard Loader

| Comments

服务器最近全面升级, php已经升级到 5.3.3, 但 ZendOptimizer 好像跟不上, ZendOptimizer-3.3.9 下载下来一看, 只支持到php5.2版本, 好吧, 如果有时间, 自己编译一份5.2削足适履吧.

脚大得不能削的, 可以考虑 Zend Guard Loader, 最新版本代替了ZendOptimizer的功用, 可以跟 php5.3.3 相处愉快,  想用看本文结尾,

我虽然脚比较大, 但心比较浅, 那就亦足吧.

解决办法

从phpinfo(); 得知尸位素餐的ZendOptimizer还是霸占了php.ini的位置:
Configuration File (php.ini) Path /etc/php5/apache2
Loaded Configuration File /usr/local/Zend/etc/php.ini


查看当前版本php所用的php.ini:
php -i | grep php.ini

得到结果:
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/idn.ini on line 1 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mhash.ini on line 1 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/mhash.so' – /usr/lib/php5/20090626+lfs/mhash.so: cannot open shared object file: No such file or directory in Unknown on line 0
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini


好吧, 顺便排个错, 把 '#' 换成 ';'
知道了php.ini的位置, 直接删除原来的链接:
cd /etc/php5/apache2
rm php.ini # 也就是这个链接 php.ini→ /usr/local/Zend/etc/php.ini
cp /etc/php5/cli/php.ini ./
/etc/init.d/apache2 restart


收工.

做点好事, 写个ZendGuardLoader安装笔记:
======
32位
http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz
64位
http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz

1, 从phpinfo(); 找到extension_dir, php.ini的位置
2, 把上面解压的ZendGuardLoader.so放在 extension_dir 目录下
3, 打开php.ini, 最后面加上一句: zend_extension=ZendGuardLoader.so
4, 重启apache就好了.

再看phpinfo();就会有如下文字了:

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright © 1998-2010 Zend Technologies
    with Zend Guard Loader v3.3, Copyright © 1998-2010, by Zend Technologies


装好了是吧, 打开页面看看, 运气怎么样? 什么? 不能访问, 那恭喜你, Zend Guard Loader 不支持老版本的PHP加密生成的代码.

Comments