柳暗花明笔记

    把 buntu 10.10 的php 5.3 降至php 5.2的方法

    所属分类:[ linux&mysql ] 猫哲学家 发表于:2012-07-30 15:59 浏览:560

    怎么说呢,因为php5.2较php5.3稳定。

    开始吧:
    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

    新建脚本文件php2.5

    #! /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 php2.5

    ./php2.5

    标签: linux  php 
    上一编文章 学习了一条好的sql语句,让我开开眼界 下一编文章 戴尔(dell)笔记本 安装ubuntu 10.10问题
    最近文章
    发表评论