Ubuntu 10.04 PHP 5.3 改為 5.2

回覆文章
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

Ubuntu 10.04 PHP 5.3 改為 5.2

文章 yehlu »

http://z-win.blogspot.com/2010/05/ubuntu-php-52x.html

# remove all php packge
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
# use karmiс for php pakage
# pin-params: a (archive), c (components), v (version), o (origin) and l (label).
echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee /etc/apt/preferences.d/php > /dev/null
apt-cache search php5-|grep php5-|awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'|sudo tee -a /etc/apt/preferences.d/php > /dev/null
apt-cache search -n libapache2-mod-php5 |awk '{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}'| sudo tee -a /etc/apt/preferences.d/php > /dev/null
echo -e "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee -a /etc/apt/preferences.d/php > /dev/null
# add karmic to source list
grep 'main restricted' /etc/apt/sources.list|grep -v "#"| sed s/lucid/karmic/g | sudo tee /etc/apt/sources.list.d/karmic.list > /dev/null
# update package database (use apt-get if aptitude crash)
sudo apt-get update
# install php
sudo aptitude install -t karmic php5-cli php5-cgi
# or (and) sudo apt-get install -t karmic libapache2-mod-php5
sudo aptitude hold `dpkg -l | grep php5| awk '{print $2}' |tr "\n" " "`
#done
#底下是我自行加裝
sudo aptitude install -t karmic libapache2-mod-php5
sudo aptitude install -t karmic php5-mysql
sudo aptitude install -t karmic php5-gb
sudo aptitude install -t karmic php5-curl
sudo aptitude install -t karmic php5-ffmpeg
sudo aptitude install -t karmic php5-json
#sudo aptitude install -t karmic php5-mcrypt
sudo aptitude install -t karmic php5-mysqli
sudo aptitude install -t karmic php5-sqlite
sudo aptitude install -t karmic php5-ldap
sudo aptitude install -t karmic php5-xmlrpc
sudo aptitude install -t karmic php5-xsl
sudo aptitude install -t karmic php5-mhash

有更新一些設定
/etc/apt/sources.d/karmic.list

deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted

deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted

deb http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe

deb http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates multiverse

deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe
deb http://security.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse

/etc/apt/preferences.d/php

Package: php5
Pin: release a=karmic
Pin-Priority: 991

Package: php5-adodb
Pin: release a=karmic
Pin-Priority: 991

Package: php5-auth-pam
Pin: release a=karmic
Pin-Priority: 991

Package: php5-exactimage
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ffmpeg
Pin: release a=karmic
Pin-Priority: 991

Package: php5-geoip
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gpib
Pin: release a=karmic
Pin-Priority: 991

Package: php5-idn
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imagick
Pin: release a=karmic
Pin-Priority: 991

Package: php5-imap
Pin: release a=karmic
Pin-Priority: 991

Package: php5-interbase
Pin: release a=karmic
Pin-Priority: 991

Package: php5-lasso
Pin: release a=karmic
Pin-Priority: 991

Package: php5-librdf
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mapscript
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mcrypt
Pin: release a=karmic
Pin-Priority: 991

Package: php5-memcache
Pin: release a=karmic
Pin-Priority: 991

Package: php5-memcached
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ming
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ps
Pin: release a=karmic
Pin-Priority: 991

Package: php5-radius
Pin: release a=karmic
Pin-Priority: 991

Package: php5-remctl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sasl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sqlrelay
Pin: release a=karmic
Pin-Priority: 991

Package: php5-suhosin
Pin: release a=karmic
Pin-Priority: 991

Package: php5-svn
Pin: release a=karmic
Pin-Priority: 991

Package: php5-symfony1.0
Pin: release a=karmic
Pin-Priority: 991

Package: php5-uuid
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xapian
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xcache
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xdebug
Pin: release a=karmic
Pin-Priority: 991

Package: php5-cgi
Pin: release a=karmic
Pin-Priority: 991

Package: php5-cli
Pin: release a=karmic
Pin-Priority: 991

Package: php5-common
Pin: release a=karmic
Pin-Priority: 991

Package: php5-curl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-dbg
Pin: release a=karmic
Pin-Priority: 991

Package: php5-dev
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gd
Pin: release a=karmic
Pin-Priority: 991

Package: php5-gmp
Pin: release a=karmic
Pin-Priority: 991

Package: php5-ldap
Pin: release a=karmic
Pin-Priority: 991

Package: php5-mysql
Pin: release a=karmic
Pin-Priority: 991

Package: php5-odbc
Pin: release a=karmic
Pin-Priority: 991

Package: php5-pgsql
Pin: release a=karmic
Pin-Priority: 991

Package: php5-pspell
Pin: release a=karmic
Pin-Priority: 991

Package: php5-recode
Pin: release a=karmic
Pin-Priority: 991

Package: php5-snmp
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sqlite
Pin: release a=karmic
Pin-Priority: 991

Package: php5-sybase
Pin: release a=karmic
Pin-Priority: 991

Package: php5-tidy
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xmlrpc
Pin: release a=karmic
Pin-Priority: 991

Package: php5-xsl
Pin: release a=karmic
Pin-Priority: 991

Package: php5-enchant
Pin: release a=karmic
Pin-Priority: 991

Package: php5-intl
Pin: release a=karmic
Pin-Priority: 991

Package: libapache2-mod-php5
Pin: release a=karmic
Pin-Priority: 991

Package: libapache2-mod-php5filter
Pin: release a=karmic
Pin-Priority: 991

Package: php-pear
Pin: release a=karmic
Pin-Priority: 991
yehlu
Site Admin
文章: 3245
註冊時間: 2004-04-15 17:20:21
來自: CodeCharge Support Engineer

Re: Ubuntu 10.04 PHP 5.3 改為 5.2

文章 yehlu »

http://www.linuxidc.com/Linux/2010-06/26566.htm

第一步:

代碼: 選擇全部

sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list
第二步:

代碼: 選擇全部

/etc/apt/preferences.d
中新建一個文件 php 內容如下:

代碼: 選擇全部

Package: php5
Pin: release a=karmic
Pin-Priority: 991
Package: php5-gd
Pin: release a=karmic
Pin-Priority: 991
Package: php5-common
Pin: release a=karmic
Pin-Priority: 991
Package: php5-curl
Pin: release a=karmic
Pin-Priority: 991
Package: php5-mysql
Pin: release a=karmic
Pin-Priority: 991
Package: php5-pear
Pin: release a=karmic
Pin-Priority: 991
Package: php5-xsl
Pin: release a=karmic
Pin-Priority: 991
Package: php-pear
Pin: release a=karmic
Pin-Priority: 991
Package: php5-cli
Pin: release a=karmic
Pin-Priority: 991
Package: php5-memcache
Pin: release a=karmic
Pin-Priority: 991
Package: php5-pgsql
Pin: release a=karmic
Pin-Priority: 991
Package: libapache2-mod-php5
Pin: release a=karmic
Pin-Priority: 991
第三步:

代碼: 選擇全部

sudo apt-get update
sudo apt-get remove php5 libapache2-mod-php5 php5-xsl php5-gd php-pear php5-mysql php5-curl php5-memcache
sudo apt-get install php5 libapache2-mod-php5 php5-xsl php5-gd php-pear php5-mysql php5-curl php5-memcache
補充: 如果沒有安裝 apache2 和 mysql 執行

代碼: 選擇全部

sudo apt-get install apache2 mysql-server php5 libapache2-mod-php5 php5-xsl php5-gd php-pear libapache2-mod-auth-mysql php5-mysql php5-curl php5-memcache
搞定 :)
ashleyjames222
文章: 1
註冊時間: 2012-01-12 15:22:26

Re: Ubuntu 10.04 PHP 5.3 改為 5.2

文章 ashleyjames222 »

Thanks you thats very informative
回覆文章

回到「Linux」