Wednesday, December 8

Downgrading PHP in Maverick Meerkat from 5.3 to 5.2

While my source code is broken and it's getting fixed I write a few lines about how to downgrade PHP in the latest ubuntu release.

The process is rather simple, and there are many ways to accomplish this, I'll post the one I use every time I break the OS

1. create a file karmic.list on /etc/apt/sources.list.d
$ kdesudo kate /etc/apt/sources.list.d/karmic.list
and put the following content

# deb cdrom:[Ubuntu 10.04 LTS _Lucid Lynx_ - Release amd64 (20100429)]/ karmic main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

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

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
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

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
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

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu karmic partner
# deb-src http://archive.canonical.com/ubuntu karmic partner

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


This just adds the repositories from Karmic Koala to our Maverick installation

2. Create a file php on /etc/apt/preferences.d/
$ kdesudo kate /etc/apt/preferences.d/php
And add this content
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: php-apc
Pin: release a=karmic
Pin-Priority: 991

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

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

Package: php5-mcrypt
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: libmagickcore2
Pin: release a=karmic
Pin-Priority: 991

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

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

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

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

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


The last 3 entries are intended to prevent imagemagick from updating to a version that cannot be used with php5-imagick, if you don't need this module just remove them to avoid downgrading imagemagick without need

3. Closing to the end, update your packages
$ sudo apt-get update

4. Now just install the php modules, the ones installed will be downgraded to v5.2 and any new one installed will be on v5.2
$ sudo apt-get install php5 php5-dev php5-curl php5-gd php5-xdebug php-pear php5-cli php5-common libapache2-mod-php5 php5-mysql php5-mcrypt php5-imagick php5-imap libmagickcore2 libgraphviz4

2 comments:

  1. Just tested on Linux Mint 10, works fine

    ReplyDelete
  2. Tested in MBP with Ubuntu 10.10, works awesome

    ReplyDelete