Saturday, January 29, 2011

downgrade PHP 5.3 to 5.2 on lenny

Unfortunately I did upgrade PHP to version 5.3, but it end up breaking up some web apps, now I'm trying to go back to 5.2. I removed both sources php53.dotdeb.org from /etc/apt/sources.list and I did apt-get update && apt-get upgrade, but it didn't downgrade anything.

Any ideas on how to go back will be appreciated

Thanks

  • Apt won't downgrade packages by default. What you want to do is for each of the packages you want to downgrade, run apt-get install <package>=<version to downgrade to>, so something like apt-get install php5-mysql=5.2.6.dfsg.1-1+lenny3 for example.

    womble : *Probably* everything relating to PHP; Most good repos tag their package versions with a unique tag, like '`dotdeb`'; I expect that `dpkg -l |grep dotdeb` will probably list all of the relevant packages; you'll need to `apt-cache policy ` to get the version you want to downgrade to.
    From womble
  • Check your /var/cache/apt/archives directory. If you haven't done an apt-get clean recently, you will have the original .deb files on your system.

    ls -al *5.2.12*deb
    

    if that contains libapache2-mod-php5 and all of the php5 modules that you normally use, you can either dpkg -i the entire list of them, or, if there aren't any extras,

    dpkg -i *5.2.12*deb
    
  • This post tell you how to install php from "karmic" repositary http://mrkandy.wordpress.com/2010/04/16/install-php-5-2-x-in-ubuntu-10-04-lucid/

    # 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 v=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 v=karmic\nPin-Priority: 991\n"}'|sudo tee  /etc/apt/preferences.d/php > /dev/null
    # add karmic to source list
    sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee -a /etc/apt/sources.list.d/karmic.list
    # update package database (use apt-get if aptitude crash)
    sudo apt-get update
    # install php
    sudo apt-get install -t karmic php5-cli php5-cgi
    #done
    
    From

0 comments:

Post a Comment