如何将某个ubuntu 10.04软件包(php)降级回karmic?

前端之家收集整理的这篇文章主要介绍了如何将某个ubuntu 10.04软件包(php)降级回karmic?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经从9.10更新到10.04,但不幸的是zend优化器尚不支持 PHP提供的 PHP.

据我所知,我需要以某种方式将10.04下提供的PHP 5.3软件包替换为9.10下提供的旧版PHP 5.2软件包.但是我不确定这是否是降级PHP的正确方法,如果是的话,我不知道如何用9.10软件包替换10.04软件包.

你能帮帮我吗?

该线程将告诉您如何在Ubuntu 10.04中将PHP从5.3降级到5.2:

http://ubuntuforums.org/archive/index.php/t-1447401.html

更新:下面的OP commented以下脚本发现here解决了他的问题.

#!/bin/bash
# by Ruben Barkow (rubo77) http://www.entikey.z11.de/

# Originally Posted by Bachstelze http://ubuntuforums.org/showthread.PHP?p=9080474#post9080474
# OK,here's how to do the Apt magic to get PHP packages from the karmic repositories:

echo "Am I root?  "
if [ "$(whoami &2>/dev/null)" != "root" ] && [ "$(id -un &2>/dev/null)" != "root" ] ; then
  echo "  NO!

Error: You must be root to run this script.
Enter
sudo su
"
  exit 1
fi
echo "  OK";


#install aptitude before,if you don`t have it:
apt-get install aptitude
# or if you prefer apt-get use:
# alias aptitude='apt-get'

# finish all apt-problems:
aptitude update
aptitude -f install
#apt-get -f install

# remove all your existing PHP packages. You can list them with dpkg -l| grep PHP
PHPLIST=$(for i in $(dpkg -l | grep PHP|awk '{ print $2 }' ); do echo $i; done)
echo these pachets will be removed: $PHPLIST 
# you need not to purge,if you have upgraded from karmic:
aptitude remove $PHPLIST
# on a fresh install,you need purge:
# aptitude remove --purge $PHPLIST


#Create a file each in /etc/apt/preferences.d like this (call it for example /etc/apt/preferences.d/PHP5_2);
#
#Package: PHP5
#Pin: release a=karmic
#Pin-Priority: 991
#
#The big problem is that wildcards don't work,so you will need one such stanza for each PHP package you want to pull from karmic:

echo ''>/etc/apt/preferences.d/PHP5_2
for i in $PHPLIST ; do echo "Package: $i
Pin: release a=karmic
Pin-Priority: 991
">>/etc/apt/preferences.d/PHP5_2; done

# duplicate your existing sources.list replacing lucid with karmic and save it in sources.list.d:
#sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list

# better exactly only the needed sources,cause otherwise you can get a cachsize problem:
echo "# needed sources vor PHP5.2:
deb http://old-releases.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic main restricted

deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates main restricted

deb http://old-releases.ubuntu.com/ubuntu/ karmic universe
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic universe
deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates universe

deb http://old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic multiverse
deb http://old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ karmic-updates multiverse

deb http://old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://old-releases.ubuntu.com/ubuntu karmic-security main restricted
deb http://old-releases.ubuntu.com/ubuntu karmic-security universe
deb-src http://old-releases.ubuntu.com/ubuntu karmic-security universe
deb http://old-releases.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://old-releases.ubuntu.com/ubuntu karmic-security multiverse
" > /etc/apt/sources.list.d/karmic.list

aptitude update

apache2ctl restart

echo install new from karmic:
aptitude -t karmic install $PHPLIST

# at the end retry the modul libapache2-mod-PHP5 in case it didn't work the first time:
aptitude -t karmic install libapache2-mod-PHP5

apache2ctl restart

猜你在找的Ubuntu相关文章