今天安装shopex时候碰到问题,安装之初就遇见乱码,说什么Zend,有爆出“Class ‘setmgr’ not found in /var/www/shopex/core/kernel.php” 这个文件;
查了下确认是Zend Optimizer 版本与php版本支持不兼容而出错:Zend Optimizer最新版支持php5.2,而Ubuntu10.04默认安装最新的php5.3啦!照这个来说zend的人还真有点儿懒,恩不少人在官网论坛上抱怨也就很正常了;
本来想着能不能装两个版本共存,后来失败,就直接降级了,把php5.3降到php5.2;
降级原理就是使用ubuntu9.10的源来装php5.2而已。
降级步骤:
1、增加karmic源:
$sudo vi /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/ubuntukarmic-security main restricted universe multiverse
2、 增加php相关包设置
$sudo vi /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
3、 建立降级脚本
3.1
$vi down5.3-5.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
3.2
$chmod 755 down5.3-5.2.sh
4、执行降级
$ sudo ./install.sh
网上有好多php降级方法,
不过经实践:此法可行!