业务系统需要在UbuntuServer10.04上安装一套PHP程序,结果总是提示Server500错误,后来发现此程序需要Zend Optimizer支持。由于Zend Optimizer需要PHP5.2.x的版本,而Ubuntu Server10.04默认的版本是PHP5.3,总是安装失败,所以一番Google大法后,找到了如下的解决方案:
UbuntuServer10.04安装Zend Optimizer手记
原创
©著作权归作者所有:来自51CTO博客作者shuqi888的原创作品,请联系作者获取转载授权,否则将追究法律责任
sudo gedit /etc/apt/sources.list.d/karmic.list
deb http://archive.ubuntu.com/ubuntu/ karmic main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ karmic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ karmic-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ karmic-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
sudo gedit /etc/apt/preferences.d/php
Package: libapache2-mod-php5
Pin: version 5.2.10*
Pin-Priority: 991
Package: libapache2-mod-php5filter
Pin: version 5.2.10*
Pin-Priority: 991
Package: php-pear
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-cgi
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-cli
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-common
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-curl
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-dbg
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-dev
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-gd
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-gmp
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-ldap
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-mhash
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-mysql
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-odbc
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-pgsql
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-pspell
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-recode
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-snmp
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-sqlite
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-sybase
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-tidy
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-xmlrpc
Pin: version 5.2.10*
Pin-Priority: 991
Package: php5-xsl
Pin: version 5.2.10*
Pin-Priority: 991
新建脚本文件php3-2.sh
#! /bin/sh -e
# Script to install PHP 5.2 from 9.10 on 10.04
# And pin it so it does not get updated
# package available and may be installed later
PKGSAVAILABLE="`aptitude search -F '%p' php5` php-pear"
PKGSINSTALLED=`dpkg -l | grep php | awk '{print $2}'`
aptitude remove $PKGSINSTALLED
# disable duplicate entries
grep 'ubuntu.com' /etc/apt/sources.list | sed s/lucid/karmic/g > tee /etc/apt/sources.list.d/karmic.list
for PACKAGE in $PKGSAVAILABLE
do
# aptitude seems to use /etc/apt/preferences but not /etc/apt/preferences.d/*
# cf https://bugs.launchpad.net/ubuntu/+source/aptitude/+bug/508545
if egrep -q "Package: ?${PACKAGE}$" /etc/apt/preferences
then
echo "$PACKAGE already in preference"
else
echo "\nPackage: ${PACKAGE}\nPin: release a=karmic\nPin-Priority: 991" >> /etc/apt/preferences
fi
done
aptitude update
aptitude install $PKGSINSTALLED
改为可执行,用root账号运行
sudo chmod +x php3-2.sh
./php3-2.sh
二、安装Zend Optimizer
首先下载Zend Optimizer3.3:
wget http://downloads.zend.com/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
安装:
$ sudo tar zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
cd /ZendOptimizer-3.3.3-linux-glibc23-i386
$ sudo ./install.sh
根据提示输php.ini文件的位置(Ubunbu Server默认在/etc/php5/apache2目录下)
在提示框中输入/etc/php5/apache2点击 ok 即可
接下来就是输入apachectl的位置(Ubunbu Server默认在/usr/sbin/apache2ctl)
在提示框加输入/usr/sbin/apache2ctl点击 ok 即可
还要输入httpd所在的目录
在提示框加输入/etc/apache2/httpd.conf即可
这里可能让你再次输入httpd所在的目录(不知到是什么原因)
完成安装后重启apache2
最后写一个phpinfo.php文件在服务器网站目录下,内容:
<?
phpinfo();
?>
用浏览器访问phpinfo.php,如果看到类似下面的提示表示安装成功:
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
上一篇:ProxmoxVE1.8上手小记
下一篇:rails处理遗留系统中的表
![](https://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
windows平台zend optimizer安装配置
mizer
php PHP Apache -
shopex安装Zend Optimizer - 3.3.0后依然乱码
下
Zend PHP C C++ C#