Home  >  Article  >  php教程  >  在Ubuntu 10.10上安装ZendOptimizer (支持apt-get方式安装的PHP)

在Ubuntu 10.10上安装ZendOptimizer (支持apt-get方式安装的PHP)

WBOY
WBOYOriginal
2016-06-06 20:08:201218browse

参考文档: http://blog.csdn.net/kings6681988/article/details/6334087 Ubuntu 10.10 系统默认的apt-get方式的PHP版本为5.3,而目前ZendOptimizer所支持php版本最高为5.2。 因此,要想支持ZendOptimizer,必须将PHP版本降级到5.2,而apt包管理工具是支持针

参考文档:
http://blog.csdn.net/kings6681988/article/details/6334087

Ubuntu 10.10 系统默认的apt-get方式的PHP版本为5.3,而目前ZendOptimizer所支持php版本最高为5.2。
因此,要想支持ZendOptimizer,必须将PHP版本降级到5.2,而apt包管理工具是支持针对特定包的版本降级的。

比如,我们发现Karmic Koala即Ubuntu 9.10版本的PHP默认就是5.2,于是我们可以通过以下方式将我们需要的 php5-cli libapache2-mod-php5 php5-gd php5-mysql php5-common 这5个软件包统一降级到5.2。

首先删除目前安装的所有php相关套件
$ sudo apt-get purge `dpkg -l | grep php| awk '{print $2}'

切换到root身份
$ sudo -i

创建依赖关系文件支持PHP降级
# echo -e "Package: php5/nPin: release a=karmic/nPin-Priority: 991/n" >> /etc/apt/preferences.d/php
# apt-cache search php5-| grep php5-| awk '{print "Package:", $1,"/nPin: release a=karmic/nPin-Priority: 991/n"}' >> /etc/apt/preferences.d/php
# apt-cache search -n libapache2-mod-php5 | awk '{print "Package:", $1,"/nPin: release a=karmic/nPin-Priority: 991/n"}' >> /etc/apt/preferences.d/php
# apt-cache search -n php5-mysql | awk '{print "Package:", $1,"/nPin: release a=karmic/nPin-Priority: 991/n"}' >> /etc/apt/preferences.d/php
# apt-cache search -n php5-gd | awk '{print "Package:", $1,"/nPin: release a=karmic/nPin-Priority: 991/n"}' >> /etc/apt/preferences.d/php

退出root身份
# exit

创建Karmic(Ubuntu 9.10版本)的APT Source
$ sudo vim /etc/apt/sources.list.d/karmic.list
deb http://old-releases.ubuntu.com/ubuntu karmic main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu karmic main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu karmic-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu karmic-security main restricted universe multiverse

更新APT数据
$ sudo apt-get update

安装 php5-cli libapache2-mod-php5 php5-gd php5-mysql php5-common 这5个软件包
$ sudo apt-get install -t karmic php5-cli libapache2-mod-php5 php5-gd php5-mysql php5-common

查看PHP版本,可以看到已经成功降级到了5.2
$ sudo php --version
PHP 5.2.10-2ubuntu6.10 with Suhosin-Patch 0.9.7 (cli) (built: May 2 2011 23:24:44)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

下载ZendOptimizer
$ wget "http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz"
$ tar xzvf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
$ cd ZendOptimizer-3.3.9-linux-glibc23-x86_64/

复制ZendOptimizer.so到系统lib目录
$ sudo cp data/5_2_x_comp/ZendOptimizer.so /usr/lib64/php5/libexec/

配置php.ini使PHP支持ZendOptimizer
$ sudo vim /etc/php5/apache2/php.ini
[ZendOptimizer]
zend_extension=/usr/lib64/php5/libexec/ZendOptimizer.so

重启Apache,即刻生效
$ sudo /etc/init.d/apache2 restart

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn